Struct WhenTest

Source
pub struct WhenTest<A, R> { /* private fields */ }
Expand description

An aggregate when a command is performed.

Implementations§

Source§

impl<A, R> WhenTest<A, R>
where A: Aggregate,

Source

pub fn into_result(self) -> R

Get the inner result from the previous when() action.

Source

pub fn into_state(self) -> A

Get the inner aggregate.

Source

pub fn then<T>(self, result: T) -> WhenTest<A, R>
where R: Debug + PartialEq<T>, T: Debug,

Then the result of the previous when() action should equal the given parameter.

Source

pub fn when<F, RR>(self, f: F) -> WhenTest<A, RR>
where F: FnOnce(&mut A) -> RR,

When a command is applied.

Source

pub fn apply(self) -> GivenTest<A>
where R: IntoEvents<<A as Aggregate>::Event>,

Apply result of previous when() action.

Source§

impl<A, R, E> WhenTest<A, Result<R, E>>
where A: Aggregate,

Source

pub fn then_ok<T>(self, result: T) -> WhenTest<A, R>
where T: Debug, R: Debug, E: Debug, Result<R, E>: PartialEq<Result<T, E>>,

Then the result of the previous when() action should be Ok(T), with T being equal the given parameter.

Source

pub fn then_err<T>(self, result: T) -> GivenTest<A>
where T: Debug, R: Debug, E: Debug, Result<R, E>: PartialEq<Result<R, T>>,

Then the result of the previous when() action should be Err(E), with E being equal the given parameter.

Auto Trait Implementations§

§

impl<A, R> Freeze for WhenTest<A, R>
where A: Freeze, R: Freeze,

§

impl<A, R> RefUnwindSafe for WhenTest<A, R>

§

impl<A, R> Send for WhenTest<A, R>
where A: Send, R: Send,

§

impl<A, R> Sync for WhenTest<A, R>
where A: Sync, R: Sync,

§

impl<A, R> Unpin for WhenTest<A, R>
where A: Unpin, R: Unpin,

§

impl<A, R> UnwindSafe for WhenTest<A, R>
where A: UnwindSafe, R: 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> 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, 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.