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>,
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>,
sourcepub fn once(self) -> QuantifiedResponse<'p, F, O, Exact>
pub fn once(self) -> QuantifiedResponse<'p, F, O, Exact>
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.
sourcepub fn n_times(self, times: usize) -> QuantifiedResponse<'p, F, O, Exact>
pub fn n_times(self, times: usize) -> QuantifiedResponse<'p, F, O, Exact>
Expect this call pattern to be matched exactly the specified number of times.
sourcepub 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>,
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>,
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.