pub struct Shutdown { /* private fields */ }Expand description
The receiving half of a shutdown signal, handed to crate::Bot::run_until
Implementations§
Source§impl Shutdown
impl Shutdown
Sourcepub fn channel() -> (ShutdownSignal, Self)
pub fn channel() -> (ShutdownSignal, Self)
Create a linked signal/receiver pair
Sourcepub fn never() -> Self
pub fn never() -> Self
A shutdown that never fires, for bots meant to run until the process exits
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Whether shutdown has already been requested
Sourcepub async fn wait(&self)
pub async fn wait(&self)
Resolve once shutdown is requested
Never resolves for Shutdown::never, so it is safe to select on
unconditionally.
Trait Implementations§
Auto Trait Implementations§
impl !Unpin for Shutdown
impl !UnsafeUnpin for Shutdown
impl Freeze for Shutdown
impl RefUnwindSafe for Shutdown
impl Send for Shutdown
impl Sync for Shutdown
impl UnwindSafe for Shutdown
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