pub struct MockService<T> { /* private fields */ }Expand description
Mock service for testing
Implementations§
Source§impl<T> MockService<T>
impl<T> MockService<T>
Sourcepub fn with_return(self, value: T) -> Self
pub fn with_return(self, value: T) -> Self
Set the return value
Sourcepub fn record_call(&self, method: &str)
pub fn record_call(&self, method: &str)
Record a method call
Sourcepub fn call_count(&self) -> usize
pub fn call_count(&self) -> usize
Get the number of calls
Sourcepub fn was_called(&self, method: &str) -> bool
pub fn was_called(&self, method: &str) -> bool
Check if a method was called
Sourcepub fn clear_calls(&self)
pub fn clear_calls(&self)
Clear all recorded calls
Sourcepub fn get_return(&self) -> Option<T>where
T: Clone,
pub fn get_return(&self) -> Option<T>where
T: Clone,
Get the mock return value
Trait Implementations§
Source§impl<T: Clone> Clone for MockService<T>
impl<T: Clone> Clone for MockService<T>
Auto Trait Implementations§
impl<T> Freeze for MockService<T>
impl<T> RefUnwindSafe for MockService<T>
impl<T> Send for MockService<T>
impl<T> Sync for MockService<T>
impl<T> Unpin for MockService<T>
impl<T> UnsafeUnpin for MockService<T>
impl<T> UnwindSafe for MockService<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<R, D> DepsPresent<D> for R
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging