Trait AggregateState

Source
pub trait AggregateState<E>: Default {
    // Required method
    fn apply_event(self, event: E) -> Self;
}
Expand description

A trait representing the state of an aggregate that can be modified by applying events.

§Type Parameters

  • E - The type of events that can be applied to the state.

Required Methods§

Source

fn apply_event(self, event: E) -> Self

Applies an event to the current state and returns the new state.

§Arguments
  • event - The event to be applied.
§Returns

The new state after the event has been applied.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<E> AggregateState<E> for Stateless

Implementation of the AggregateState trait for the Stateless struct.

This implementation does not modify the state when an event is applied.