[−][src]Struct eventually_core::aggregate::AggregateRoot
An AggregateRoot represents an handler to the Aggregate it's managing,
such as:
- Owning the current, local Aggregate
State, - Proxying
Commands to theAggregateusing the currentState, - Keeping a list of
Events to commit afterCommandexecution.
Initialize
AggregateRoot can be initialized in two ways:
-
Using the
From<Aggregate>method:let root = AggregateRoot::from(aggregate); -
Using the
AggregateExtextension trait to callroot()on theAggregateinstance:// This will result in a Clone of the Aggregate instance. let root = aggregate.root();
Implementations
impl<T> AggregateRoot<T> where
T: Aggregate, [src]
T: Aggregate,
impl<T> AggregateRoot<T> where
T: Aggregate, [src]
T: Aggregate,
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]
T: AggregateExt,
T::Event: Clone,
T::State: Clone,
pub async fn handle<'_, '_>(
&'_ mut self,
command: T::Command
) -> Result<&'_ mut Self, T::Error>[src]
&'_ mut self,
command: T::Command
) -> Result<&'_ mut Self, T::Error>
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]
T: Aggregate + 'static,
T::State: Debug,
T::Event: Debug,
impl<T> From<T> for AggregateRoot<T> where
T: Aggregate,
T::State: Default, [src]
T: Aggregate,
T::State: Default,
impl<T> Identifiable for AggregateRoot<T> where
T: Aggregate, [src]
T: Aggregate,
type Id = AggregateId<T>
Type of the data id. An id must support total equality. Read more
fn id(&self) -> Self::Id[src]
impl<T> PartialEq<AggregateRoot<T>> for AggregateRoot<T> where
T: Aggregate, [src]
T: Aggregate,
Auto Trait Implementations
impl<T> RefUnwindSafe for AggregateRoot<T> where
T: RefUnwindSafe,
<T as Aggregate>::Event: RefUnwindSafe,
<T as Aggregate>::State: RefUnwindSafe,
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,
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,
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,
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,
T: UnwindSafe,
<T as Aggregate>::Event: UnwindSafe,
<T as Aggregate>::State: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,