pub struct DecisionMaker<SS> { /* private fields */ }Expand description
The DecisionMaker struct is responsible for executing and persisting business decisions.
Implementations§
Source§impl<SS> DecisionMaker<SS>
impl<SS> DecisionMaker<SS>
Sourcepub fn new(state_store: SS) -> Self
pub fn new(state_store: SS) -> Self
Creates a new instance of DecisionMaker.
§Parameters
state_store: The state store backend used by theDecisionMakerto load the current state and persist the decision.
Sourcepub async fn make<D, S, ID, E>(
&self,
decision: D,
) -> Result<Vec<PersistedEvent<ID, E>>, Error<D::Error>>where
ID: EventId,
E: Event + Clone + Sync + Send + 'static,
SS: LoadState<ID, S, E> + PersistDecision<ID, S, E>,
D: Decision<StateQuery = S, Event = E>,
S: Send + Sync + Serialize + DeserializeOwned + IntoStatePart<ID, S>,
<S as IntoStatePart<ID, S>>::Target: Send + Sync + Serialize + DeserializeOwned + IntoState<S> + MultiState<ID, E>,
<D as Decision>::Error: 'static,
pub async fn make<D, S, ID, E>(
&self,
decision: D,
) -> Result<Vec<PersistedEvent<ID, E>>, Error<D::Error>>where
ID: EventId,
E: Event + Clone + Sync + Send + 'static,
SS: LoadState<ID, S, E> + PersistDecision<ID, S, E>,
D: Decision<StateQuery = S, Event = E>,
S: Send + Sync + Serialize + DeserializeOwned + IntoStatePart<ID, S>,
<S as IntoStatePart<ID, S>>::Target: Send + Sync + Serialize + DeserializeOwned + IntoState<S> + MultiState<ID, E>,
<D as Decision>::Error: 'static,
Makes the given business decision, persisting the resulting events in the event store.
§Parameters
decision: The business decision to be executed, implementing theDecisiontrait.
§Returns
A Result indicating the success of the decision-making process. If successful,
it contains a vector of PersistedEvent representing the changes made. In case of
an error, it contains details about the encountered issue.
Trait Implementations§
Source§impl<SS: Clone> Clone for DecisionMaker<SS>
impl<SS: Clone> Clone for DecisionMaker<SS>
Source§fn clone(&self) -> DecisionMaker<SS>
fn clone(&self) -> DecisionMaker<SS>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<SS> Freeze for DecisionMaker<SS>where
SS: Freeze,
impl<SS> RefUnwindSafe for DecisionMaker<SS>where
SS: RefUnwindSafe,
impl<SS> Send for DecisionMaker<SS>where
SS: Send,
impl<SS> Sync for DecisionMaker<SS>where
SS: Sync,
impl<SS> Unpin for DecisionMaker<SS>where
SS: Unpin,
impl<SS> UnwindSafe for DecisionMaker<SS>where
SS: UnwindSafe,
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