Trait ViewStateComputation

Source
pub trait ViewStateComputation<E, S> {
    // Required method
    fn compute_new_state(&self, current_state: Option<S>, events: &[&E]) -> S;
}
Expand description

Formalizes the State Computation algorithm for the view to handle events based on the current state, and produce new state.

Required Methods§

Source

fn compute_new_state(&self, current_state: Option<S>, events: &[&E]) -> S

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

Implementors§

Source§

impl<S, E> ViewStateComputation<E, S> for View<'_, S, E>

Source§

impl<S, E, Repository, View, Error> ViewStateComputation<E, S> for MaterializedView<S, E, Repository, View, Error>
where Repository: ViewStateRepository<E, S, Error>, View: ViewStateComputation<E, S>,