Skip to main content

ViewStateComputation

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.

Dyn Compatibility§

This trait is dyn compatible.

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

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