Skip to main content

DecisionMaker

Struct DecisionMaker 

Source
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>

Source

pub fn new(state_store: SS) -> Self

Creates a new instance of DecisionMaker.

§Parameters
  • state_store: The state store backend used by the DecisionMaker to load the current state and persist the decision.
Source

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 the Decision trait.
§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>

Source§

fn clone(&self) -> DecisionMaker<SS>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V