pub struct Expectation { /* private fields */ }
Expand description
Expectation type for methods taking a &self
argument and
returning immutable references. This is the type returned by
the expect_*
methods.
Implementations§
Source§impl Expectation
impl Expectation
Sourcepub fn call(&self) -> &i32
pub fn call(&self) -> &i32
Call this Expectation
as if it were the real method.
Sourcepub fn return_const(&mut self, __mockall_o: i32) -> &mut Self
pub fn return_const(&mut self, __mockall_o: i32) -> &mut Self
Return a reference to a constant value from the Expectation
Sourcepub fn in_sequence(&mut self, __mockall_seq: &mut Sequence) -> &mut Self
pub fn in_sequence(&mut self, __mockall_seq: &mut Sequence) -> &mut Self
Add this expectation to a
Sequence
.
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new, default, Expectation
Sourcepub fn once(&mut self) -> &mut Self
pub fn once(&mut self) -> &mut Self
Expect this expectation to be called exactly once. Shortcut for
times(1)
.
Sourcepub fn times<MockallR>(&mut self, __mockall_r: MockallR) -> &mut Selfwhere
MockallR: Into<TimesRange>,
pub fn times<MockallR>(&mut self, __mockall_r: MockallR) -> &mut Selfwhere
MockallR: Into<TimesRange>,
Restrict the number of times that that this method may be called.
The argument may be:
- A fixed number:
.times(4)
- Various types of range:
.times(5..10)
.times(..10)
.times(5..)
.times(5..=10)
.times(..=10)
- The wildcard:
.times(..)
Sourcepub fn with<MockallMatcher0: Predicate<i32> + Send + 'static>(
&mut self,
x: MockallMatcher0,
) -> &mut Self
pub fn with<MockallMatcher0: Predicate<i32> + Send + 'static>( &mut self, x: MockallMatcher0, ) -> &mut Self
Set matching crieteria for this Expectation.
The matching predicate can be anything implemening the
Predicate
trait. Only
one matcher can be set per Expectation
at a time.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Expectation
impl RefUnwindSafe for Expectation
impl Send for Expectation
impl Sync for Expectation
impl Unpin for Expectation
impl UnwindSafe for Expectation
Blanket Implementations§
Source§impl<T> Any for T
impl<T> Any for T
Source§fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
TODO: once 1.33.0 is the minimum supported compiler version, remove
Any::type_id_compat and use StdAny::type_id instead.
https://github.com/rust-lang/rust/issues/27745
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