Struct shutdown_async::ShutdownMonitor
source · pub struct ShutdownMonitor { /* private fields */ }
Expand description
A ShutdownMonitor
listens for the shutdown signal from a ShutdownController
and
tracks that the signal has been received.
Callers may query for whether the shutdown signal has been received or not.
Implementations§
source§impl ShutdownMonitor
impl ShutdownMonitor
sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Returns true
if the shutdown signal has been received, and false
otherwise.
Examples
#[tokio::main]
async fn main() {
let shutdown = shutdown_async::ShutdownController::new();
let mut monitor = shutdown.subscribe();
assert!(!monitor.is_shutdown());
}