pub struct ShutdownToken { /* private fields */ }Expand description
Hierarchical, cooperative shutdown token.
Cloning a token is cheap: all clones share the same underlying state. Child
tokens notify their parent on ShutdownToken::signal_shutdown, so any
component can request a process-wide shutdown.
Implementations§
Source§impl ShutdownToken
impl ShutdownToken
Sourcepub fn child(&self) -> Self
pub fn child(&self) -> Self
Derive a child token that propagates its shutdown signal to self.
Calling ShutdownToken::signal_shutdown on the child will also
signal the parent. The child has its own internal flag, so a parent
that is already shutdown will not cause spurious wakeups on a
freshly-created child.
Sourcepub fn signal_shutdown(&self)
pub fn signal_shutdown(&self)
Signal shutdown. Idempotent; subsequent calls are no-ops.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Returns true if ShutdownToken::signal_shutdown has been called on
this token or any of its ancestors.
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShutdownToken
impl Debug for ShutdownToken
Source§impl Default for ShutdownToken
impl Default for ShutdownToken
Source§fn default() -> ShutdownToken
fn default() -> ShutdownToken
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ShutdownToken
impl RefUnwindSafe for ShutdownToken
impl Send for ShutdownToken
impl Sync for ShutdownToken
impl Unpin for ShutdownToken
impl UnsafeUnpin 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