pub struct StateMachine { /* private fields */ }Implementations§
Source§impl StateMachine
impl StateMachine
pub fn new(config: StateConfig) -> Result<StateMachine, AgentError>
pub fn current(&self) -> String
pub fn previous(&self) -> Option<String>
pub fn current_definition(&self) -> Option<StateDefinition>
pub fn get_definition(&self, state: &str) -> Option<&StateDefinition>
pub fn get_parent_definition(&self) -> Option<StateDefinition>
pub fn transition_to(&self, state: &str, reason: &str) -> Result<(), AgentError>
pub fn available_transitions(&self) -> Vec<Transition>
pub fn auto_transitions(&self) -> Vec<Transition>
pub fn history(&self) -> Vec<StateTransitionEvent>
pub fn increment_turn(&self)
pub fn turn_count(&self) -> u32
pub fn increment_no_transition(&self)
pub fn no_transition_count(&self) -> u32
pub fn reset_no_transition(&self)
pub fn check_fallback(&self) -> Option<String>
pub fn reset(&self)
pub fn snapshot(&self) -> StateMachineSnapshot
pub fn restore(&self, snapshot: StateMachineSnapshot) -> Result<(), AgentError>
pub fn config(&self) -> &StateConfig
pub fn check_timeout(&self) -> Option<String>
pub fn current_depth(&self) -> usize
pub fn is_in_sub_state(&self) -> bool
pub fn parent_state(&self) -> Option<String>
pub fn root_state(&self) -> String
Sourcepub fn is_on_cooldown(&self, target: &str, cooldown_turns: u32) -> bool
pub fn is_on_cooldown(&self, target: &str, cooldown_turns: u32) -> bool
Check if a transition target is on cooldown (was recently transitioned to).
Auto Trait Implementations§
impl !Freeze for StateMachine
impl !RefUnwindSafe for StateMachine
impl Send for StateMachine
impl Sync for StateMachine
impl Unpin for StateMachine
impl UnsafeUnpin for StateMachine
impl UnwindSafe for StateMachine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.