Skip to main content

StateComputation

Trait StateComputation 

Source
pub trait StateComputation<C, S, E, Error = ()> {
    // Required method
    fn compute_new_state(
        &self,
        current_state: Option<S>,
        command: &C,
    ) -> Result<S, Error>;
}
Expand description

Formalizes the State Computation algorithm / state-stored system for the decider to handle commands based on the current state, and produce new state.

Required Methods§

Source

fn compute_new_state( &self, current_state: Option<S>, command: &C, ) -> Result<S, Error>

Computes new state based on the current state and the command.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<C, S, E, Error> StateComputation<C, S, E, Error> for Decider<'_, C, S, E, Error>

Source§

impl<C, S, E, Repository, Decider, Version, Error> StateComputation<C, S, E, Error> for StateStoredAggregate<C, S, E, Repository, Decider, Version, Error>
where Repository: StateRepository<C, S, Version, Error>, Decider: StateComputation<C, S, E, Error>,

Source§

impl<C, S, E, Repository, Version, Error> StateComputation<C, S, E, Error> for StateStoredOrchestratingAggregate<'_, C, S, E, Repository, Version, Error>
where Repository: StateRepository<C, S, Version, Error>, S: Clone,