Trait StateManager

Source
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§

Source

fn init() -> Result<ProtocolStateMachine, StateError>

Initialize protocol state.

Source

fn transition(&mut self, new_state: ProtocolState) -> Result<(), StateError>

Transition to a new state.

Source

fn get_state(&self) -> &ProtocolState

Get current state.

Source

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.

Implementors§