Struct tokio_scoped::Scope
source · [−]pub struct Scope<'a> { /* private fields */ }
Implementations
sourceimpl<'a> Scope<'a>
impl<'a> Scope<'a>
sourcepub fn spawn<'s, F>(&'s mut self, future: F) -> &mut Self where
F: Future<Output = ()> + Send + 'a,
'a: 's,
pub fn spawn<'s, F>(&'s mut self, future: F) -> &mut Self where
F: Future<Output = ()> + Send + 'a,
'a: 's,
Spawn the provided future on the Handle
to the tokio Runtime
.
sourcepub fn scope<'inner, F, R>(&'inner self, f: F) -> R where
F: FnOnce(&mut Scope<'inner>) -> R,
'a: 'inner,
pub fn scope<'inner, F, R>(&'inner self, f: F) -> R where
F: FnOnce(&mut Scope<'inner>) -> R,
'a: 'inner,
Creates an inner
scope which can access variables created within the outer scope.
sourcepub fn block_on<'s, R, F>(&'s mut self, future: F) -> R where
F: Future<Output = R> + Send + 'a,
R: Send + Debug + 'a,
'a: 's,
pub fn block_on<'s, R, F>(&'s mut self, future: F) -> R where
F: Future<Output = R> + Send + 'a,
R: Send + Debug + 'a,
'a: 's,
Blocks the “current thread” of the runtime until future
resolves. Other independently
spawned futures will be moved to different threads and can make progress while
this future is running.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Scope<'a>
impl<'a> Send for Scope<'a>
impl<'a> Sync for Scope<'a>
impl<'a> Unpin for Scope<'a>
impl<'a> !UnwindSafe for Scope<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more