Files
kaptan/firmware/libs/kaptan-log/src/shutdown.rs
T

35 lines
1.0 KiB
Rust

//! Explicit shutdown taxonomy for a future platform-owned shutdown state machine.
/// Why an orderly output-inhibited shutdown completed.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[repr(u8)]
pub enum ShutdownReason {
/// A user initiated the controlled stop.
User = 1,
/// Safety initiated the controlled stop.
Safety = 2,
}
/// One completed orderly firmware shutdown report.
///
/// This is a typed terminal-state observation from a future platform-owned
/// shutdown coordinator. It is emitted only after that coordinator has
/// inhibited outputs. It is deliberately not a shutdown request or a panic,
/// hard-fault, or reset report.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct ShutdownReport {
reason: ShutdownReason,
}
impl ShutdownReport {
/// Creates one completed orderly shutdown report.
pub const fn new(reason: ShutdownReason) -> Self {
Self { reason }
}
/// Completed orderly shutdown reason.
pub const fn reason(self) -> ShutdownReason {
self.reason
}
}