Struct unimock::build::QuantifyReturnValue

source ·
pub struct QuantifyReturnValue<'p, F, T, O>
where F: MockFn, T: IntoReturnOnce<F::OutputKind>, <<F as MockFn>::OutputKind as Kind>::Return: IntoReturner<F>,
{ /* private fields */ }
Expand description

Builder for defining how a call pattern with an explicit return value gets verified with regards to quantification/counting.

Implementations§

source§

impl<'p, F, T, O> QuantifyReturnValue<'p, F, T, O>
where F: MockFn, T: IntoReturnOnce<F::OutputKind>, O: Copy, <<F as MockFn>::OutputKind as Kind>::Return: IntoReturner<F>,

source

pub fn once(self) -> QuantifiedResponse<'p, F, O, Exact>
where <<F as MockFn>::OutputKind as Kind>::Return: IntoReturner<F>,

Expect this call pattern to be matched exactly once.

This is the only quantifier that works together with return values that don’t implement Clone.

source

pub fn n_times(self, times: usize) -> QuantifiedResponse<'p, F, O, Exact>
where T: IntoReturn<F::OutputKind>, <<F as MockFn>::OutputKind as Kind>::Return: IntoReturner<F>,

Expect this call pattern to be matched exactly the specified number of times.

source

pub fn at_least_times( self, times: usize ) -> QuantifiedResponse<'p, F, O, AtLeast>
where T: IntoReturn<F::OutputKind>, O: Ordering<Kind = InAnyOrder>, <<F as MockFn>::OutputKind as Kind>::Return: IntoReturner<F>,

Expect this call pattern to be matched at least the specified number of times.

This only works for call patterns matched in any ordered. Strictly ordered call patterns must have exact quantification.

Trait Implementations§

source§

impl<'p, F, T, O> Drop for QuantifyReturnValue<'p, F, T, O>
where F: MockFn, T: IntoReturnOnce<F::OutputKind>, <<F as MockFn>::OutputKind as Kind>::Return: IntoReturner<F>,

The drop implementation of this is intended to run when used in a stubbing clause, when the call pattern is left unquantified by the user.

In that case, it is only able to return once, because no Clone bound has been part of any construction step.

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'p, F, T, O> Clause for QuantifyReturnValue<'p, F, T, O>
where F: MockFn, T: IntoReturnOnce<F::OutputKind>, O: Copy + Ordering, <<F as MockFn>::OutputKind as Kind>::Return: IntoReturner<F>,

Auto Trait Implementations§

§

impl<'p, F, T, O> Freeze for QuantifyReturnValue<'p, F, T, O>
where O: Freeze, T: Freeze,

§

impl<'p, F, T, O> !RefUnwindSafe for QuantifyReturnValue<'p, F, T, O>

§

impl<'p, F, T, O> Send for QuantifyReturnValue<'p, F, T, O>
where O: Send, T: Send, F: Send,

§

impl<'p, F, T, O> Sync for QuantifyReturnValue<'p, F, T, O>
where O: Sync, T: Sync, F: Sync,

§

impl<'p, F, T, O> Unpin for QuantifyReturnValue<'p, F, T, O>
where O: Unpin, T: Unpin, F: Unpin,

§

impl<'p, F, T, O> !UnwindSafe for QuantifyReturnValue<'p, F, T, O>

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> Is for T
where T: ?Sized,

§

type EqTo = T

source§

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

§

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

§

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.