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 duplicate 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 Freeze for TaskTracker
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