#[repr(u8)]pub enum LifecycleState {
Unconfigured = 1,
Inactive = 2,
Active = 3,
Finalized = 4,
ErrorProcessing = 5,
}Expand description
Lifecycle state (REP-2002)
A lifecycle node is always in exactly one of these states.
Variants§
Unconfigured = 1
Initial state after construction. Node is not yet configured.
Inactive = 2
Node is configured but not processing data.
Active = 3
Node is fully operational and processing data.
Finalized = 4
Terminal state. Node cannot be reused.
ErrorProcessing = 5
Error occurred during a transition. Must recover or shut down.
Implementations§
Source§impl LifecycleState
impl LifecycleState
Sourcepub const ALL: [LifecycleState; 5]
pub const ALL: [LifecycleState; 5]
Every reachable state, in lifecycle_msgs id order.
phase-417 W4.f. nros_node::lifecycle_services held this list
privately, so the wire could enumerate the states and no in-process
caller in any of the three languages could. It is a CONSTANT, not
state — the point of moving it here is that there is one of it.
Sourcepub const fn is_terminal(&self) -> bool
pub const fn is_terminal(&self) -> bool
Returns true if this is a terminal state (Finalized).
Sourcepub const fn is_primary(&self) -> bool
pub const fn is_primary(&self) -> bool
Returns true if this is a primary state (not a transition state).
Primary states are: Unconfigured, Inactive, Active, Finalized. ErrorProcessing is the only non-primary state.
Sourcepub const fn from_u8(value: u8) -> Option<LifecycleState>
pub const fn from_u8(value: u8) -> Option<LifecycleState>
Try to convert from a u8 value.
Sourcepub const fn label_cstr(&self) -> &'static CStr
pub const fn label_cstr(&self) -> &'static CStr
The lifecycle_msgs/msg/State.label for this state, NUL-terminated.
The C string is the SOURCE spelling and Self::label is derived from
it, not the other way round: the C API hands this pointer straight to a
caller (rclc_lifecycle_state_label), and a second set of literals for
the &str form is exactly the drift this move exists to remove.
Sourcepub fn label(&self) -> &'static str
pub fn label(&self) -> &'static str
The lifecycle_msgs/msg/State.label for this state.
Infallible in practice — every label above is ASCII — but expressed
without an unwrap, because a panic on a const table is a panic
nobody can act on. The empty string is unreachable, and
every_label_is_valid_utf8 is the test that keeps it so.
Trait Implementations§
Source§impl Clone for LifecycleState
impl Clone for LifecycleState
Source§fn clone(&self) -> LifecycleState
fn clone(&self) -> LifecycleState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more