Skip to main content

RuntimeStateMachine

Struct RuntimeStateMachine 

Source
pub struct RuntimeStateMachine { /* private fields */ }
Expand description

Concrete runtime state machine with run tracking.

Implementations§

Source§

impl RuntimeStateMachine

Source

pub fn new() -> Self

Create a new state machine in the Initializing state.

Source

pub fn from_state(state: RuntimeState) -> Self

Create from an existing state (for recovery).

Source

pub fn state(&self) -> RuntimeState

Get the current state.

Source

pub fn current_run_id(&self) -> Option<&RunId>

Get the current run ID (if running).

Source

pub fn is_idle(&self) -> bool

Check if the runtime is idle.

Source

pub fn is_running(&self) -> bool

Check if the runtime is running.

Source

pub fn can_process_queue(&self) -> bool

Check if the runtime can process queued inputs.

True for Idle and Retired (Retired drains existing queue).

Source

pub fn transition( &mut self, next: RuntimeState, ) -> Result<RuntimeState, RuntimeStateTransitionError>

Transition to a new state.

Source

pub fn start_run( &mut self, run_id: RunId, ) -> Result<(), RuntimeStateTransitionError>

Transition to Running with a specific run ID.

Records the pre-run state so complete_run() can return to it (e.g. Retired → Running → Retired for queue drain).

Source

pub fn complete_run(&mut self) -> Result<RunId, RuntimeStateTransitionError>

Transition from Running back to the pre-run state (run completed).

Returns to Retired if the run was started from Retired (drain mode), otherwise returns to Idle.

Source

pub fn initialize(&mut self) -> Result<(), RuntimeStateTransitionError>

Mark as initialized (Initializing → Idle).

Source

pub fn reset_to_idle( &mut self, ) -> Result<Option<RuntimeState>, RuntimeStateTransitionError>

Reset the runtime back to Idle after lifecycle cleanup.

Allowed only when not Running. Revives a retired runtime so callers can keep using the same logical runtime instance after abandoning queued work.

Trait Implementations§

Source§

impl Clone for RuntimeStateMachine

Source§

fn clone(&self) -> RuntimeStateMachine

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RuntimeStateMachine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RuntimeStateMachine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more