Trait causality::Actor[][src]

pub trait Actor<C: Cause, E: Effect, Err: Error> {
    type Id;
    type Version;
    fn handle(&self, cause: C) -> Result<Vec<E>, Err>;
fn apply(&mut self, effects: Vec<E>) -> Result<(), Err>; }

Entity that handles Causes producing one or more Effects upon success.

Implemented for Root Aggregates or Aggregates in Event Sourcing.

Associated Types

type Id[src]

Unique Id for Actor.

type Version[src]

Version of Actor dependent on Effects applied.

Loading content...

Required methods

fn handle(&self, cause: C) -> Result<Vec<E>, Err>[src]

Handle Cause returning vector of Effects or error.

fn apply(&mut self, effects: Vec<E>) -> Result<(), Err>[src]

Apply Effects on Actor.

Loading content...

Implementors

Loading content...