Trait mockers::Expectation

source ·
pub trait Expectation {
    // Required methods
    fn call_match(&self) -> &dyn CallMatch;
    fn is_satisfied(&self) -> bool;
    fn satisfy(&mut self, call: Call, mock_name: &str) -> Box<dyn Satisfy>;
    fn describe(&self) -> String;
}
Expand description

Expectation is a combination of call match and corresponding action.

Expectations are built using mock handle methods:

let (mock, handle) = scenario.create_mock_for::<dyn A>();
let expectation = handle.foo().and_return(());

and are added to scenario:

scenario.expect(expectation);

Required Methods§

source

fn call_match(&self) -> &dyn CallMatch

source

fn is_satisfied(&self) -> bool

source

fn satisfy(&mut self, call: Call, mock_name: &str) -> Box<dyn Satisfy>

source

fn describe(&self) -> String

Implementors§

source§

impl Expectation for Sequence

source§

impl<Arg0: 'static, Arg1: 'static, Arg2: 'static, Arg3: 'static, Res: 'static> Expectation for ExpectationTimes4<Arg0, Arg1, Arg2, Arg3, Res>

source§

impl<Arg0: 'static, Arg1: 'static, Arg2: 'static, Arg3: 'static, Res: 'static> Expectation for ExpectationTimesSend4<Arg0, Arg1, Arg2, Arg3, Res>

source§

impl<Arg0: 'static, Arg1: 'static, Arg2: 'static, Arg3: 'static, Res: 'static, F: FnOnce(Arg0, Arg1, Arg2, Arg3) -> Res + 'static> Expectation for Expectation4<Arg0, Arg1, Arg2, Arg3, Res, F>

source§

impl<Arg0: 'static, Arg1: 'static, Arg2: 'static, Arg3: 'static, Res: 'static, F: FnOnce(Arg0, Arg1, Arg2, Arg3) -> Res + Send + 'static> Expectation for ExpectationSend4<Arg0, Arg1, Arg2, Arg3, Res, F>

source§

impl<Arg0: 'static, Arg1: 'static, Arg2: 'static, Res: 'static> Expectation for ExpectationTimes3<Arg0, Arg1, Arg2, Res>

source§

impl<Arg0: 'static, Arg1: 'static, Arg2: 'static, Res: 'static> Expectation for ExpectationTimesSend3<Arg0, Arg1, Arg2, Res>

source§

impl<Arg0: 'static, Arg1: 'static, Arg2: 'static, Res: 'static, F: FnOnce(Arg0, Arg1, Arg2) -> Res + 'static> Expectation for Expectation3<Arg0, Arg1, Arg2, Res, F>

source§

impl<Arg0: 'static, Arg1: 'static, Arg2: 'static, Res: 'static, F: FnOnce(Arg0, Arg1, Arg2) -> Res + Send + 'static> Expectation for ExpectationSend3<Arg0, Arg1, Arg2, Res, F>

source§

impl<Arg0: 'static, Arg1: 'static, Res: 'static> Expectation for ExpectationTimes2<Arg0, Arg1, Res>

source§

impl<Arg0: 'static, Arg1: 'static, Res: 'static> Expectation for ExpectationTimesSend2<Arg0, Arg1, Res>

source§

impl<Arg0: 'static, Arg1: 'static, Res: 'static, F: FnOnce(Arg0, Arg1) -> Res + 'static> Expectation for Expectation2<Arg0, Arg1, Res, F>

source§

impl<Arg0: 'static, Arg1: 'static, Res: 'static, F: FnOnce(Arg0, Arg1) -> Res + Send + 'static> Expectation for ExpectationSend2<Arg0, Arg1, Res, F>

source§

impl<Arg0: 'static, Res: 'static> Expectation for ExpectationTimes1<Arg0, Res>

source§

impl<Arg0: 'static, Res: 'static> Expectation for ExpectationTimesSend1<Arg0, Res>

source§

impl<Arg0: 'static, Res: 'static, F: FnOnce(Arg0) -> Res + 'static> Expectation for Expectation1<Arg0, Res, F>

source§

impl<Arg0: 'static, Res: 'static, F: FnOnce(Arg0) -> Res + Send + 'static> Expectation for ExpectationSend1<Arg0, Res, F>

source§

impl<CM: CallMatch> Expectation for ExpectationNever<CM>

source§

impl<E: Expectation> Expectation for SendWrapper<E>

SendWrapper of any Expectation is also Expectation.

Scenario expects all expectations to be Send, and expectations produces by Send mocks are. Expectatinos produces by non-Send mocks are wrapped into SendWrapper, which guarantee that expectation is used from the same thread at runtime.

source§

impl<Res: 'static> Expectation for ExpectationTimes0<Res>

source§

impl<Res: 'static> Expectation for ExpectationTimesSend0<Res>

source§

impl<Res: 'static, F: FnOnce() -> Res + 'static> Expectation for Expectation0<Res, F>

source§

impl<Res: 'static, F: FnOnce() -> Res + Send + 'static> Expectation for ExpectationSend0<Res, F>