pub struct ShutdownToken { /* private fields */ }Expand description
Cloneable observer handle.
Hand one of these to every subsystem that needs to react to
shutdown. The handle is cheap to clone (single Arc::clone).
Implementations§
Source§impl ShutdownToken
impl ShutdownToken
Sourcepub fn is_initiated(&self) -> bool
pub fn is_initiated(&self) -> bool
true if shutdown has been initiated.
Sourcepub fn reason(&self) -> Option<ShutdownReason>
pub fn reason(&self) -> Option<ShutdownReason>
Reason for the shutdown, if one has been initiated.
Sourcepub fn wait_blocking(&self)
pub fn wait_blocking(&self)
Block the current thread until shutdown is initiated.
Returns immediately if shutdown is already initiated.
Sourcepub fn wait_blocking_timeout(&self, timeout: Duration) -> bool
pub fn wait_blocking_timeout(&self, timeout: Duration) -> bool
Block the current thread for at most timeout.
Returns true if shutdown was observed within the budget,
false if the timeout elapsed first.
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 moreAuto 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