pub struct TaskScope(/* private fields */);Expand description
A collection of tokio task abort handles that aborts all still-running tasks on drop.
Finished handles are pruned each time a new task is spawned, so the scope does not accumulate memory for completed tasks.
Implementations§
Source§impl TaskScope
impl TaskScope
Sourcepub fn spawn_local<F>(&mut self, future: F) -> JoinHandle<F::Output> ⓘ
pub fn spawn_local<F>(&mut self, future: F) -> JoinHandle<F::Output> ⓘ
Spawn a !Send future on the current LocalRuntime and
track its abort handle in this scope.
Sourcepub fn spawn<F>(&mut self, future: F) -> JoinHandle<F::Output> ⓘ
pub fn spawn<F>(&mut self, future: F) -> JoinHandle<F::Output> ⓘ
Spawn a future on the current tokio runtime and track its abort handle in this scope.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskScope
impl RefUnwindSafe for TaskScope
impl Send for TaskScope
impl Sync for TaskScope
impl Unpin for TaskScope
impl UnsafeUnpin for TaskScope
impl UnwindSafe for TaskScope
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
Mutably borrows from an owned value. Read more