pub struct ShutdownToken(Receiver<()>);Expand description
Shutdown signal handed to a worker at spawn time. Workers select! between
their input source and &mut self.0; reducer-task exit drops the matched
Sender<()> and the receiver resolves with Err(RecvError). Workers
treat any resolution as “shutdown” and exit cleanly.
Tuple Fields§
§0: Receiver<()>Implementations§
Source§impl ShutdownToken
impl ShutdownToken
Sourcepub fn into_inner(self) -> Receiver<()>
pub fn into_inner(self) -> Receiver<()>
Unwrap to the inner Receiver<()> for direct use in select!. The
idiomatic pattern is:
ⓘ
let mut shutdown = token.into_inner();
loop {
tokio::select! {
_ = &mut shutdown => return,
msg = input.recv() => { ... }
}
}Auto Trait Implementations§
impl Freeze for ShutdownToken
impl !RefUnwindSafe for ShutdownToken
impl Send for ShutdownToken
impl Sync for ShutdownToken
impl Unpin for ShutdownToken
impl !UnwindSafe for ShutdownToken
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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