pub trait StateManager {
// Required methods
fn init() -> Result<ProtocolStateMachine, StateError>;
fn transition(&mut self, new_state: ProtocolState) -> Result<(), StateError>;
fn get_state(&self) -> &ProtocolState;
fn validate_transition(&self, new_state: &ProtocolState) -> bool;
}
Expand description
State management trait defining the interface for state operations.
Required Methods§
Sourcefn init() -> Result<ProtocolStateMachine, StateError>
fn init() -> Result<ProtocolStateMachine, StateError>
Initialize protocol state.
Sourcefn transition(&mut self, new_state: ProtocolState) -> Result<(), StateError>
fn transition(&mut self, new_state: ProtocolState) -> Result<(), StateError>
Transition to a new state.
Sourcefn get_state(&self) -> &ProtocolState
fn get_state(&self) -> &ProtocolState
Get current state.
Sourcefn validate_transition(&self, new_state: &ProtocolState) -> bool
fn validate_transition(&self, new_state: &ProtocolState) -> bool
Validate state transition.
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.