pub struct Lifecycle { /* private fields */ }Expand description
Lifecycle state manager.
Implementations§
Source§impl Lifecycle
impl Lifecycle
Sourcepub const fn new(agent_id: AgentId) -> Self
pub const fn new(agent_id: AgentId) -> Self
Constructs a lifecycle controller for the given agent.
Sourcepub const fn state(&self) -> AgentState
pub const fn state(&self) -> AgentState
Returns the current state.
Sourcepub fn transition(
&mut self,
event: LifecycleEvent,
) -> LifecycleResult<AgentState>
pub fn transition( &mut self, event: LifecycleEvent, ) -> LifecycleResult<AgentState>
Applies a lifecycle event, returning the resulting state.
§Errors
Returns LifecycleError::InvalidTransition when the supplied event is not
allowed from the current state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Lifecycle
impl RefUnwindSafe for Lifecycle
impl Send for Lifecycle
impl Sync for Lifecycle
impl Unpin for Lifecycle
impl UnwindSafe for Lifecycle
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)