pub struct ShutdownToken { /* private fields */ }Expand description
Created by a ShutdownController.
Serves two purposes:
- Wait for a shutdown request to happen with
Self::wait - Keep track of the current task. While this token is held,
ShutdownController::wait_all_task_shutdownwill block.
Implementations§
Source§impl ShutdownToken
impl ShutdownToken
Sourcepub fn split(self) -> (CancellationToken, TaskTrackerToken)
pub fn split(self) -> (CancellationToken, TaskTrackerToken)
Returns underlying CancellationToken and TaskTrackerToken, consuming self.
Sourcepub fn wait(&self) -> WaitForCancellationFuture<'_>
pub fn wait(&self) -> WaitForCancellationFuture<'_>
Returns a future that will resolve only when a shutdown request happened.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Returns true if the shutdown request happened
Sourcepub fn ask_shutdown(&self)
pub fn ask_shutdown(&self)
Ask for all tasks to quit
Trait Implementations§
Source§impl Clone for ShutdownToken
impl Clone for ShutdownToken
Source§fn clone(&self) -> ShutdownToken
fn clone(&self) -> ShutdownToken
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 ShutdownToken
impl RefUnwindSafe for ShutdownToken
impl Send for ShutdownToken
impl Sync for ShutdownToken
impl Unpin for ShutdownToken
impl UnwindSafe for ShutdownToken
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