pub trait StateTransition: Debug + Sized {
// Required methods
fn can_transition_to(&self, next: &Self) -> bool;
fn is_terminal(&self) -> bool;
// Provided method
fn transition(self, next: Self) -> Result<Self> { ... }
}Expand description
Common trait for all state machine enums.
Each subsystem (filesystem, security, resources, isolation, network, checkpoint)
defines its own state enum with domain-specific transition rules. This trait
provides the shared transition() method so each enum only needs to implement
can_transition_to().
Required Methods§
Sourcefn can_transition_to(&self, next: &Self) -> bool
fn can_transition_to(&self, next: &Self) -> bool
Return true if moving from self to next is a valid transition.
Sourcefn is_terminal(&self) -> bool
fn is_terminal(&self) -> bool
Return true if this state is terminal (no forward transitions).
Provided Methods§
Sourcefn transition(self, next: Self) -> Result<Self>
fn transition(self, next: Self) -> Result<Self>
Attempt to transition, returning Err(InvalidStateTransition) on failure.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.