Skip to main content

Context

Trait Context 

Source
pub trait Context {
    type State;
    type Command;
    type Event;
    type Fault;

    // Required methods
    fn initial() -> Self::State;
    fn decide(
        state: &Self::State,
        command: &Self::Command,
    ) -> Result<Self::Event, Self::Fault>;
    fn apply(state: Self::State, event: &Self::Event) -> Self::State;
}

Required Associated Types§

Required Methods§

Source

fn initial() -> Self::State

Source

fn decide( state: &Self::State, command: &Self::Command, ) -> Result<Self::Event, Self::Fault>

Source

fn apply(state: Self::State, event: &Self::Event) -> Self::State

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§