[][src]Struct spy::SpySnapshot

pub struct SpySnapshot<Args: PartialEq> { /* fields omitted */ }

The structure represents a snapshot of a spy object. Taken snapshot contains all the calls starting from the moment when Spy object was created or previous snapshot if there was taken one.

Generic type Args is in fact a tuple that describes argument values for each call.

Methods

impl<Args: PartialEq> SpySnapshot<Args>[src]

pub fn called(&self) -> bool[src]

It returns true if spy function was called at least once and false otherwise.

pub fn called_with(&self, args: Args) -> bool[src]

It returns true if spy function was called at least once with provided arguments and false otherwise.

pub fn each_called_with(&self, args: Args) -> bool[src]

It returns true if spy function was called with provided arguments each time it was called.

pub fn num_of_calls(&self) -> usize[src]

It returns how many times spy function was called.

pub fn all_calls(&self) -> &Vec<Args>[src]

It returns a vector that contains all calls arguments.

pub fn first_call(&self) -> Option<&Args>[src]

It returns first call arguments. None will be returned if spy function was not called till the moment when a snapshot was taken.

pub fn last_call(&self) -> Option<&Args>[src]

It returns last call arguments. None will be returned if spy function was not called till the moment when a snapshot was taken.

pub fn nth_call(&self, n: usize) -> Option<&Args>[src]

It returns n-th call arguments. None will be returned if spy function was not called enough times till the moment when a snapshot was taken.

Auto Trait Implementations

impl<Args> Unpin for SpySnapshot<Args> where
    Args: Unpin

impl<Args> Send for SpySnapshot<Args> where
    Args: Send

impl<Args> Sync for SpySnapshot<Args> where
    Args: Sync

impl<Args> UnwindSafe for SpySnapshot<Args> where
    Args: UnwindSafe

impl<Args> RefUnwindSafe for SpySnapshot<Args> where
    Args: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]