pub struct Scope<'scope, 'env, T>where
'env: 'scope,{ /* private fields */ }
Expand description
A TaskPool
scope for running one or more non-'static
futures.
For more information, see TaskPool::scope
.
Implementations§
source§impl<'scope, 'env, T> Scope<'scope, 'env, T>where
T: Send + 'env,
impl<'scope, 'env, T> Scope<'scope, 'env, T>where
T: Send + 'env,
sourcepub fn spawn<Fut>(&self, f: Fut)where
Fut: Future<Output = T> + 'scope,
pub fn spawn<Fut>(&self, f: Fut)where
Fut: Future<Output = T> + 'scope,
Spawns a scoped future onto the executor. The scope must outlive
the provided future. The results of the future will be returned as a part of
TaskPool::scope
’s return value.
On the single threaded task pool, it just calls Scope::spawn_on_scope
.
For more information, see TaskPool::scope
.
sourcepub fn spawn_on_external<Fut>(&self, f: Fut)where
Fut: Future<Output = T> + 'scope,
pub fn spawn_on_external<Fut>(&self, f: Fut)where
Fut: Future<Output = T> + 'scope,
Spawns a scoped future onto the executor. The scope must outlive
the provided future. The results of the future will be returned as a part of
TaskPool::scope
’s return value.
On the single threaded task pool, it just calls Scope::spawn_on_scope
.
For more information, see TaskPool::scope
.
sourcepub fn spawn_on_scope<Fut>(&self, f: Fut)where
Fut: Future<Output = T> + 'scope,
pub fn spawn_on_scope<Fut>(&self, f: Fut)where
Fut: Future<Output = T> + 'scope,
Spawns a scoped future that runs on the thread the scope called from. The
scope must outlive the provided future. The results of the future will be
returned as a part of TaskPool::scope
’s return value.
For more information, see TaskPool::scope
.
Trait Implementations§
Auto Trait Implementations§
impl<'scope, 'env, T> Freeze for Scope<'scope, 'env, T>
impl<'scope, 'env, T> !RefUnwindSafe for Scope<'scope, 'env, T>
impl<'scope, 'env, T> !Send for Scope<'scope, 'env, T>
impl<'scope, 'env, T> !Sync for Scope<'scope, 'env, T>
impl<'scope, 'env, T> Unpin for Scope<'scope, 'env, T>
impl<'scope, 'env, T> !UnwindSafe for Scope<'scope, 'env, T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more