Struct mimicry::RealCallSwitch
source · pub struct RealCallSwitch(_);
Expand description
Switch between real and mocked implementations.
A field of this type should be present on a struct for #[derive(CallReal)]
to work.
Examples
#[derive(Mock, CallReal)]
struct MockState {
// other fields...
_switch: RealCallSwitch,
}
// You can now use `CallReal` methods in mock logic:
impl MockState {
fn mock_something(&self, arg: &str) {
self.call_real().scope(|| { /* ... */ });
}
}
Trait Implementations
sourceimpl Debug for RealCallSwitch
impl Debug for RealCallSwitch
sourceimpl Default for RealCallSwitch
impl Default for RealCallSwitch
sourcefn default() -> RealCallSwitch
fn default() -> RealCallSwitch
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for RealCallSwitch
impl Send for RealCallSwitch
impl !Sync for RealCallSwitch
impl Unpin for RealCallSwitch
impl UnwindSafe for RealCallSwitch
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more