[][src]Trait domain_patterns::models::Applier

pub trait Applier: AggregateRoot {
    type EventError;
    fn apply(&mut self, event: Self::Events) -> Result<(), Self::EventError>;
}

Applier should be implemented by aggregate roots in systems where you want to apply messages (commands or events) to mutate an aggregate.

Associated Types

type EventError

EventError should be filled in with a custom error type that indicates something went wrong when applying the event to the aggregate.

Loading content...

Required methods

fn apply(&mut self, event: Self::Events) -> Result<(), Self::EventError>

Apply takes in an event enum, of the type declared during the creation of the aggregate root, and internally should match to assess the specific variant. Application of internal mutation should then depend upon the event type, and event data. It's useful to build out other internal methods for applying each event type that apply can call for cleanliness.

Loading content...

Implementors

Loading content...