Struct tokio_task_tracker::TaskTracker
source · pub struct TaskTracker { /* private fields */ }
Expand description
A TaskTracker is used both as a token to keep track of active tasks, and as a cancellation token to check to see if the current task should quit.
Implementations§
source§impl TaskTracker
impl TaskTracker
sourcepub fn spawn<T, F: FnOnce(TaskTracker) -> T>(
&self,
f: F
) -> JoinHandle<T::Output>
pub fn spawn<T, F: FnOnce(TaskTracker) -> T>( &self, f: F ) -> JoinHandle<T::Output>
Spawn a subtask.
The given closure will be called, passing in a task tracker.
sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns true if this token has been cancelled.
Trait Implementations§
source§impl Clone for TaskTracker
impl Clone for TaskTracker
source§fn clone(&self) -> TaskTracker
fn clone(&self) -> TaskTracker
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for TaskTracker
impl Send for TaskTracker
impl Sync for TaskTracker
impl Unpin for TaskTracker
impl !UnwindSafe for TaskTracker
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