State

Enum State 

Source
pub enum State<C: ?Sized + Config> {
    Born,
    Idle,
    Busy,
    Next(<C::Plan as Scheduler>::State),
    Done(ExitStatus),
    Gone(ExitStatus),
}
Expand description

Represents the state of a Continuation throughout its lifecycle.

A Continuation starts in the Born state without references to shared data or its future, as provided by its owning Job or Agent. After binding pinned references to it, the Continuation moves to the Idle state, indicating it is unscheduled.

From the Idle state, the Continuation can be scheduled by inserting it into the event calendar at a specific model time, transitioning it to the Next state. When the model time reaches this point and the Continuation is activated, it enters the Busy state.

Upon completion, the Continuation transitions to the Done state, indicating that a return value is available for extraction. At any point before normal termination, the Continuation can be aborted, moving it to the Gone state and dropping its bound future. The Gone state is the final state in a Continuation’s lifecycle.

--- title: State Transition Diagram --- flowchart LR Born{{Born}}-->Idle{{Idle}} Born{{Born}}-->Gone{{Gone}} Idle{{Idle}}-->Next{{Next}} Idle{{Idle}}-->Gone{{Gone}} Busy{{Busy}}-->Idle{{Idle}} Busy{{Busy}}-->Done{{Done}} Next{{Next}}-->Idle{{Idle}} Next{{Next}}-->Busy{{Busy}} Done{{Done}}-->Gone{{Gone}}

Variants§

§

Born

State of a continuation signifying a non-bound future and shared data.

§

Idle

State of a continuation that is waiting for external reactivation.

§

Busy

State of the continuation that is currently active. At most one continuation may be in this state during a simulation run at any time.

§

Next(<C::Plan as Scheduler>::State)

State of a continuation that is managed by the calendar.

§

Done(ExitStatus)

State of a completed continuation with a result available for extraction.

§

Gone(ExitStatus)

State of a continuation that cannot be scheduled anymore.

Implementations§

Source§

impl<C: ?Sized + Config> State<C>

Source

pub const fn is_born(&self) -> bool

Returns true if the current state is Self::Born and false otherwise.

Source

pub const fn is_idle(&self) -> bool

Returns true if the current state is Self::Idle and false otherwise.

Source

pub const fn is_busy(&self) -> bool

Returns true if the current state is Self::Busy and false otherwise.

Source

pub const fn is_next(&self) -> bool

Returns true if the current state is Self::Next and false otherwise.

Source

pub const fn is_done(&self) -> bool

Returns true if the current state is Self::Done and false otherwise.

Source

pub const fn is_gone(&self) -> bool

Returns true if the current state is Self::Gone and false otherwise.

Source

pub const fn is_init(&self) -> bool

Returns true if the current state is Self::Idle or Self::Busy or Self::Next or Self::Done or Self::Gone and false otherwise.

Source

pub const fn is_term(&self) -> bool

Returns true if the current state is Self::Done or Self::Gone and false otherwise.

Trait Implementations§

Source§

impl<C: ?Sized + Config> Debug for State<C>

Source§

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

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

impl<C: ?Sized + Config> Default for State<C>

Source§

fn default() -> State<C>

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

impl<C: ?Sized + Config> FSM for State<C>

Source§

type Token<'brand> = State<'brand>

Type of generically branded token.
Source§

type Erased = State

Type of the stateless enumeration of all possible states.
Source§

fn token<'brand>( this: &Self, once: Ephemeral<'brand>, _: Private, ) -> Self::Token<'brand>

Private trait function to convert a branded Ephemeral into an equally branded machine-specific token type. Read more
Source§

fn erased(&self) -> Self::Erased

Erases the configuration-specific payloads from the enumeration, returning a type-erased version.
Source§

fn label(&self) -> &'static str

Returns the name of the current state as a string.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Born<'b>, Born<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Born<'b>, _data: Self::Data, _: Private, ) -> Born<'b>

Updates the state of Born, requiring a Born-token and returning it.

Source§

type Data = ()

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Born<'b>, Gone<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Born<'b>, data: Self::Data, p: Private, ) -> Gone<'b>

Performs the transition between Born and Gone, requiring a Born-token and returning the resulting Gone-token.

Source§

type Data = <State<C> as Transition<'b, Gone<'b>, Gone<'b>>>::Data

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Born<'b>, Idle<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Born<'b>, data: Self::Data, p: Private, ) -> Idle<'b>

Performs the transition between Born and Idle, requiring a Born-token and returning the resulting Idle-token.

Source§

type Data = <State<C> as Transition<'b, Idle<'b>, Idle<'b>>>::Data

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Busy<'b>, Busy<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Busy<'b>, _data: Self::Data, _: Private, ) -> Busy<'b>

Updates the state of Busy, requiring a Busy-token and returning it.

Source§

type Data = ()

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Busy<'b>, Done<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Busy<'b>, data: Self::Data, p: Private, ) -> Done<'b>

Performs the transition between Busy and Done, requiring a Busy-token and returning the resulting Done-token.

Source§

type Data = <State<C> as Transition<'b, Done<'b>, Done<'b>>>::Data

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Busy<'b>, Idle<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Busy<'b>, data: Self::Data, p: Private, ) -> Idle<'b>

Performs the transition between Busy and Idle, requiring a Busy-token and returning the resulting Idle-token.

Source§

type Data = <State<C> as Transition<'b, Idle<'b>, Idle<'b>>>::Data

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Done<'b>, Done<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Done<'b>, _data: Self::Data, _: Private, ) -> Done<'b>

Updates the state of Done, requiring a Done-token and returning it.

Source§

type Data = Result<Success, Failure>

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Done<'b>, Gone<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Done<'b>, data: Self::Data, p: Private, ) -> Gone<'b>

Performs the transition between Done and Gone, requiring a Done-token and returning the resulting Gone-token.

Source§

type Data = <State<C> as Transition<'b, Gone<'b>, Gone<'b>>>::Data

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Gone<'b>, Gone<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Gone<'b>, _data: Self::Data, _: Private, ) -> Gone<'b>

Updates the state of Gone, requiring a Gone-token and returning it.

Source§

type Data = Result<Success, Failure>

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Idle<'b>, Gone<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Idle<'b>, data: Self::Data, p: Private, ) -> Gone<'b>

Performs the transition between Idle and Gone, requiring a Idle-token and returning the resulting Gone-token.

Source§

type Data = <State<C> as Transition<'b, Gone<'b>, Gone<'b>>>::Data

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Idle<'b>, Idle<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Idle<'b>, _data: Self::Data, _: Private, ) -> Idle<'b>

Updates the state of Idle, requiring a Idle-token and returning it.

Source§

type Data = ()

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Idle<'b>, Next<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Idle<'b>, data: Self::Data, p: Private, ) -> Next<'b>

Performs the transition between Idle and Next, requiring a Idle-token and returning the resulting Next-token.

Source§

type Data = <State<C> as Transition<'b, Next<'b>, Next<'b>>>::Data

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Next<'b>, Busy<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Next<'b>, data: Self::Data, p: Private, ) -> Busy<'b>

Performs the transition between Next and Busy, requiring a Next-token and returning the resulting Busy-token.

Source§

type Data = <State<C> as Transition<'b, Busy<'b>, Busy<'b>>>::Data

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Next<'b>, Idle<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Next<'b>, data: Self::Data, p: Private, ) -> Idle<'b>

Performs the transition between Next and Idle, requiring a Next-token and returning the resulting Idle-token.

Source§

type Data = <State<C> as Transition<'b, Idle<'b>, Idle<'b>>>::Data

Associated type specifying the payload of the destination state V.
Source§

impl<'b, C: ?Sized + Config> Transition<'b, Next<'b>, Next<'b>> for State<C>

Source§

fn transition( this: &mut Self, token: Next<'b>, _data: Self::Data, _: Private, ) -> Next<'b>

Updates the state of Next, requiring a Next-token and returning it.

Source§

type Data = <<C as Config>::Plan as Scheduler>::State

Associated type specifying the payload of the destination state V.

Auto Trait Implementations§

§

impl<C> Freeze for State<C>
where <<C as Config>::Plan as Scheduler>::State: Freeze, C: ?Sized,

§

impl<C> RefUnwindSafe for State<C>
where <<C as Config>::Plan as Scheduler>::State: RefUnwindSafe, C: ?Sized,

§

impl<C> Send for State<C>
where <<C as Config>::Plan as Scheduler>::State: Send, C: ?Sized,

§

impl<C> Sync for State<C>
where <<C as Config>::Plan as Scheduler>::State: Sync, C: ?Sized,

§

impl<C> Unpin for State<C>
where <<C as Config>::Plan as Scheduler>::State: Unpin, C: ?Sized,

§

impl<C> UnwindSafe for State<C>
where <<C as Config>::Plan as Scheduler>::State: UnwindSafe, C: ?Sized,

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> 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, 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