pub trait CallReal {
fn real_switch(&self) -> &RealCallSwitch;
fn call_real<R>(&self, action: impl FnOnce() -> R) -> R { ... }
fn call_real_once<R>(&self, action: impl FnOnce() -> R) -> R { ... }
}
Expand description
Controls delegation to real impls. The provided call_*
methods in this trait can be used
for partial mocking and spying.
Required Methods
fn real_switch(&self) -> &RealCallSwitch
fn real_switch(&self) -> &RealCallSwitch
Returns a reference to the call switch.
Provided Methods
Runs the provided closure with all calls to the mocked function / method being directed to “real” implementation.
fn call_real_once<R>(&self, action: impl FnOnce() -> R) -> R
fn call_real_once<R>(&self, action: impl FnOnce() -> R) -> R
Runs the provided closure with the first call to the mocked function / method being directed to “real” implementation. Further calls will be directed to the mock.