pub struct EntityRef<E>where
E: EventSourced,{ /* private fields */ }Expand description
A handle representing a spawned EventSourcedEntity, which can be used to pass it commands.
Implementations§
Source§impl<E> EntityRef<E>where
E: EventSourced,
impl<E> EntityRef<E>where
E: EventSourced,
Sourcepub fn id(&self) -> &E::Id
pub fn id(&self) -> &E::Id
The ID of the represented EventSourcedEntity.
Sourcepub async fn handle_command<C>(
&self,
command: C,
) -> Result<Result<C::Reply, C::Error>, HandleCommandError>where
C: Command<E>,
pub async fn handle_command<C>(
&self,
command: C,
) -> Result<Result<C::Reply, C::Error>, HandleCommandError>where
C: Command<E>,
Pass the given command to the represented EventSourcedEntity. The returned value is a nested result where the outer one represents technical errors, e.g. problems connecting to the event log, and the inner one comes from the command handler, i.e. signals potential command rejection.
Trait Implementations§
Auto Trait Implementations§
impl<E> Freeze for EntityRef<E>
impl<E> RefUnwindSafe for EntityRef<E>
impl<E> Send for EntityRef<E>
impl<E> Sync for EntityRef<E>
impl<E> Unpin for EntityRef<E>
impl<E> UnwindSafe for EntityRef<E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more