pub struct ShutdownReceiver { /* private fields */ }
Expand description
Contains methods to wait for a “clean shutdown” signal in asynchronous tasks.
Implementations§
Source§impl ShutdownReceiver
impl ShutdownReceiver
Sourcepub async fn watch(&mut self)
pub async fn watch(&mut self)
Waits for this ShutdownReceiver’s corresponding ShutdownSender to signal that it’s time to shutdown. Doesn’t return until then.
The ShutdownReceiver MUST be dropped as a result of this method returning.
Sourcepub fn spawn_with_shutdown<T>(
shutdown: ShutdownReceiver,
todo: T,
task_name: impl Display + Send + 'static + Sync,
timeout: Option<Duration>,
)
pub fn spawn_with_shutdown<T>( shutdown: ShutdownReceiver, todo: T, task_name: impl Display + Send + 'static + Sync, timeout: Option<Duration>, )
Spawn a new async task that will automatically be dropped when the provided ShutdownReceiver is signaled.
Trait Implementations§
Source§impl Clone for ShutdownReceiver
impl Clone for ShutdownReceiver
Source§fn clone(&self) -> ShutdownReceiver
fn clone(&self) -> ShutdownReceiver
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 ShutdownReceiver
impl RefUnwindSafe for ShutdownReceiver
impl Send for ShutdownReceiver
impl Sync for ShutdownReceiver
impl Unpin for ShutdownReceiver
impl UnwindSafe for ShutdownReceiver
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