pub struct ShutdownGuard { /* private fields */ }Expand description
RAII guard that tracks shutdown state.
When all clones of a ShutdownGuard are dropped, the associated
shutdown is considered complete. Cloning the guard and sending the
clone to background tasks allows the main task to wait for all
tasks to finish by dropping the original guard.
Implementations§
Source§impl ShutdownGuard
impl ShutdownGuard
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Check if shutdown has been signaled.
Sourcepub async fn wait_for_shutdown(&self)
pub async fn wait_for_shutdown(&self)
Wait for shutdown to be signaled.
Trait Implementations§
Source§impl Clone for ShutdownGuard
impl Clone for ShutdownGuard
Source§fn clone(&self) -> ShutdownGuard
fn clone(&self) -> ShutdownGuard
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 Default for ShutdownGuard
impl Default for ShutdownGuard
Source§impl Drop for ShutdownGuard
impl Drop for ShutdownGuard
Auto Trait Implementations§
impl Freeze for ShutdownGuard
impl RefUnwindSafe for ShutdownGuard
impl Send for ShutdownGuard
impl Sync for ShutdownGuard
impl Unpin for ShutdownGuard
impl UnsafeUnpin for ShutdownGuard
impl UnwindSafe for ShutdownGuard
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