[][src]Struct eventually_core::aggregate::AggregateRoot

pub struct AggregateRoot<T> where
    T: Aggregate + 'static, 
{ /* fields omitted */ }

An AggregateRoot represents an handler to the Aggregate it's managing, such as:

Initialize

AggregateRoot can be initialized in two ways:

  1. Using the From<Aggregate> method:

    let root = AggregateRoot::from(aggregate);
    
  2. Using the AggregateExt extension trait to call root() on the Aggregate instance:

    // This will result in a Clone of the Aggregate instance.
    let root = aggregate.root();
    

Implementations

impl<T> AggregateRoot<T> where
    T: Aggregate
[src]

pub fn state(&self) -> &T::State[src]

Returns a reference to the current Aggregate State.

impl<T> AggregateRoot<T> where
    T: Aggregate
[src]

pub fn new(aggregate: T, state: T::State) -> Self[src]

Creates a new AggregateRoot instance wrapping the specified State.

impl<T> AggregateRoot<T> where
    T: AggregateExt,
    T::Event: Clone,
    T::State: Clone
[src]

pub async fn handle<'_, '_>(
    &'_ mut self,
    command: T::Command
) -> Result<&'_ mut Self, T::Error>
[src]

Handles the submitted Command using the Aggregate::handle method and updates the Aggregate State.

Returns a &mut self reference to allow for method chaining.

Trait Implementations

impl<T: Debug> Debug for AggregateRoot<T> where
    T: Aggregate + 'static,
    T::State: Debug,
    T::Event: Debug
[src]

impl<T> From<T> for AggregateRoot<T> where
    T: Aggregate,
    T::State: Default
[src]

impl<T> Identifiable for AggregateRoot<T> where
    T: Aggregate
[src]

type Id = AggregateId<T>

Type of the data id. An id must support total equality. Read more

impl<T> PartialEq<AggregateRoot<T>> for AggregateRoot<T> where
    T: Aggregate
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for AggregateRoot<T> where
    T: RefUnwindSafe,
    <T as Aggregate>::Event: RefUnwindSafe,
    <T as Aggregate>::State: RefUnwindSafe

impl<T> Send for AggregateRoot<T> where
    T: Send,
    <T as Aggregate>::Event: Send,
    <T as Aggregate>::State: Send

impl<T> Sync for AggregateRoot<T> where
    T: Sync,
    <T as Aggregate>::Event: Sync,
    <T as Aggregate>::State: Sync

impl<T> Unpin for AggregateRoot<T> where
    T: Unpin,
    <T as Aggregate>::Event: Unpin,
    <T as Aggregate>::State: Unpin

impl<T> UnwindSafe for AggregateRoot<T> where
    T: UnwindSafe,
    <T as Aggregate>::Event: UnwindSafe,
    <T as Aggregate>::State: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.