Struct mry::MockLocator
source · pub struct MockLocator<I, O, B> { /* private fields */ }
Expand description
Mock locator returned by mock_* methods
Implementations§
source§impl<I, O, B> MockLocator<I, O, B>
impl<I, O, B> MockLocator<I, O, B>
sourcepub fn returns_with<T: Into<B>>(self, behavior: T) -> Self
pub fn returns_with<T: Into<B>>(self, behavior: T) -> Self
Returns value with using a closure. Arguments of a method call are passed to the given closure.
sourcepub fn returns_once(self, ret: O) -> Self
pub fn returns_once(self, ret: O) -> Self
Returns value once. After that, it panics.
source§impl<I, O, B> MockLocator<I, O, B>where
I: 'static,
O: 'static,
impl<I, O, B> MockLocator<I, O, B>where
I: 'static,
O: 'static,
sourcepub fn calls_real_impl(self) -> Self
pub fn calls_real_impl(self) -> Self
This make the mock calls real impl. This is used for partial mocking.
sourcepub fn assert_called(&self, times: impl Into<Times>)
pub fn assert_called(&self, times: impl Into<Times>)
Assert the mock is called.
Returns MockResult
allows to call times(n)
Panics if not called
Auto Trait Implementations§
impl<I, O, B> !RefUnwindSafe for MockLocator<I, O, B>
impl<I, O, B> !Send for MockLocator<I, O, B>
impl<I, O, B> !Sync for MockLocator<I, O, B>
impl<I, O, B> Unpin for MockLocator<I, O, B>
impl<I, O, B> !UnwindSafe for MockLocator<I, O, B>
Blanket Implementations§
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