[][src]Enum xaynet::state_machine::StateMachine

pub enum StateMachine<R> {
    Idle(PhaseState<R, Idle>),
    Sum(PhaseState<R, Sum>),
    Update(PhaseState<R, Update>),
    Sum2(PhaseState<R, Sum2>),
    Unmask(PhaseState<R, Unmask>),
    Error(PhaseState<R, StateError>),
    Shutdown(PhaseState<R, Shutdown>),

The state machine with all its states.


Idle(PhaseState<R, Idle>)
Sum(PhaseState<R, Sum>)
Update(PhaseState<R, Update>)
Sum2(PhaseState<R, Sum2>)
Unmask(PhaseState<R, Unmask>)
Shutdown(PhaseState<R, Shutdown>)


impl<R> StateMachine<R> where
    PhaseState<R, Idle>: Phase<R> + Purge<R>,
    PhaseState<R, Sum>: Phase<R> + Purge<R>,
    PhaseState<R, Update>: Phase<R> + Purge<R>,
    PhaseState<R, Sum2>: Phase<R> + Purge<R>,
    PhaseState<R, Unmask>: Phase<R> + Purge<R>,
    PhaseState<R, StateError>: Phase<R> + Purge<R>,
    PhaseState<R, Shutdown>: Phase<R> + Purge<R>, 

pub fn new(
    pet_settings: PetSettings,
    mask_settings: MaskSettings,
    model_settings: ModelSettings
) -> Result<(Self, RequestSender<R>, EventSubscriber), InitError>

Creates a new state machine with the initial state Idle.


Fails if there is insufficient system entropy to generate secrets.

    Note: If the StateMachine is created via
    PhaseState::::new(...) it must be ensured that the module
    sodiumoxide::init() has been initialized beforehand.

For example:

This example deliberately fails to compile
let state_machine =
    StateMachine::from(PhaseState::<R, Idle>::new(coordinator_state, req_receiver));

pub async fn next(self) -> Option<Self>[src]

Moves the StateMachine to the next state and consumes the current one. Returns the next state or None if the StateMachine reached the state Shutdown.

pub async fn run(__arg0: Self) -> Option<()>[src]

Runs the state machine until it shuts down. The StateMachine shuts down once all RequestSender have been dropped.

Trait Implementations

impl<R> From<PhaseState<R, Idle>> for StateMachine<R>[src]

impl<R> From<PhaseState<R, Shutdown>> for StateMachine<R>[src]

impl<R> From<PhaseState<R, StateError>> for StateMachine<R>[src]

impl<R> From<PhaseState<R, Sum>> for StateMachine<R>[src]

impl<R> From<PhaseState<R, Sum2>> for StateMachine<R>[src]

impl<R> From<PhaseState<R, Unmask>> for StateMachine<R>[src]

impl<R> From<PhaseState<R, Update>> for StateMachine<R>[src]

Auto Trait Implementations

impl<R> !RefUnwindSafe for StateMachine<R>

impl<R> Send for StateMachine<R> where
    R: Send

impl<R> Sync for StateMachine<R> where
    R: Send

impl<R> Unpin for StateMachine<R>

impl<R> !UnwindSafe for StateMachine<R>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]