pub struct Statistics {
pub initiated: bool,
pub reason: Option<ShutdownReason>,
pub hooks_registered: usize,
pub hooks_completed: usize,
pub elapsed: Option<Duration>,
}Expand description
Snapshot of coordinator state, returned by
Coordinator::statistics.
All fields are public for direct read access. The snapshot is a value type; subsequent state changes on the coordinator do not affect a previously-taken snapshot.
§Examples
use signal_mod::{Coordinator, ShutdownReason};
let coord = Coordinator::builder().build();
let stats_before = coord.statistics();
assert!(!stats_before.initiated);
assert_eq!(stats_before.hooks_registered, 0);
coord.trigger().trigger(ShutdownReason::Requested);
let stats_after = coord.statistics();
assert!(stats_after.initiated);
assert_eq!(stats_after.reason, Some(ShutdownReason::Requested));Fields§
§initiated: booltrue if shutdown has been initiated.
reason: Option<ShutdownReason>Reason carried with the trigger that initiated shutdown.
hooks_registered: usizeNumber of hooks registered on the coordinator.
hooks_completed: usizeCumulative number of hook runs completed across all
run_hooks calls.
elapsed: Option<Duration>Wall-clock time since shutdown was initiated.
Trait Implementations§
Source§impl Clone for Statistics
impl Clone for Statistics
Source§fn clone(&self) -> Statistics
fn clone(&self) -> Statistics
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 moreAuto Trait Implementations§
impl Freeze for Statistics
impl RefUnwindSafe for Statistics
impl Send for Statistics
impl Sync for Statistics
impl Unpin for Statistics
impl UnsafeUnpin for Statistics
impl UnwindSafe for Statistics
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