Skip to main content

AsyncMock

Struct AsyncMock 

Source
pub struct AsyncMock<R: Send + 'static> { /* private fields */ }
Expand description

Expectations for one concrete future type.

Each matching poll returns Ready. Calls are counted when polled, not when the future is created. Arguments stored inside a future cannot be matched.

Implementations§

Source§

impl<R: Send + 'static> AsyncMock<R>

Source

pub fn expect(&self) -> AsyncExpectation<R>

Starts an expectation. By default any number of calls is allowed.

Source

pub fn verify(&self)

Checks call counts and unexpected calls, and panics if either failed.

Source

pub fn checkpoint(&self)

Checks expectations like Self::verify, then clears them for the next phase.

Auto Trait Implementations§

§

impl<R> Freeze for AsyncMock<R>
where Arc<State<AsyncRule<R>>>: Freeze,

§

impl<R> RefUnwindSafe for AsyncMock<R>
where Arc<State<AsyncRule<R>>>: RefUnwindSafe,

§

impl<R> Send for AsyncMock<R>
where Arc<State<AsyncRule<R>>>: Send,

§

impl<R> Sync for AsyncMock<R>
where Arc<State<AsyncRule<R>>>: Sync,

§

impl<R> Unpin for AsyncMock<R>
where Arc<State<AsyncRule<R>>>: Unpin,

§

impl<R> UnsafeUnpin for AsyncMock<R>
where Arc<State<AsyncRule<R>>>: UnsafeUnpin,

§

impl<R> UnwindSafe for AsyncMock<R>
where Arc<State<AsyncRule<R>>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.