Function vin_core::shutdown_future
source · pub fn shutdown_future<'a>() -> Notified<'a>Expand description
Registers a shutdown future.
Useful in loops aside from the main actor loops to cancel activities.
Example
Just as an
ⓘ
let shutdown = vin::shutdown_future();
tokio::pin!(shutdown);
loop {
tokio::select! {
msg = tcp_stream.read() => {
...
},
...
_ = &mut shutdown => {
info!("Received shutdown signal.");
break;
},
}
}