[][src]Struct embedded_hal_mock::common::Generic

pub struct Generic<T: Clone + Debug + PartialEq> { /* fields omitted */ }

Generic Mock implementation

This supports the specification and evaluation of expectations to allow automated testing of hal drivers. Mismatches between expectations will cause runtime assertions to assist in locating the source of the fault.

Note that the implementation uses an Arc<Mutex<...>> internally, so a cloned instance of the mock can be used to check the expectations of the original instance that has been moved into a driver.

Implementations

impl<'a, T: 'a> Generic<T> where
    T: Clone + Debug + PartialEq
[src]

pub fn new<E>(expected: E) -> Generic<T> where
    E: IntoIterator<Item = &'a T>, 
[src]

Create a new mock interface

This creates a new generic mock interface with initial expectations

pub fn expect<E>(&mut self, expected: E) where
    E: IntoIterator<Item = &'a T>, 
[src]

Set expectations on the interface

This is a list of transactions to be executed in order Note that setting this will overwrite any existing expectations

pub fn done(&mut self)[src]

Assert that all expectations on a given Mock have been met

Trait Implementations

impl<T> Clone for Generic<T> where
    T: Clone + Debug + PartialEq
[src]

Clone allows a single mock to be duplicated for control and evaluation

impl<T: Debug + Clone + PartialEq> Debug for Generic<T>[src]

impl<T> Iterator for Generic<T> where
    T: Clone + Debug + PartialEq
[src]

Iterator impl for use in mock impls

type Item = T

The type of the elements being iterated over.

Auto Trait Implementations

impl<T> RefUnwindSafe for Generic<T>

impl<T> Send for Generic<T> where
    T: Send

impl<T> Sync for Generic<T> where
    T: Send

impl<T> Unpin for Generic<T>

impl<T> UnwindSafe for Generic<T>

Blanket Implementations

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

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

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

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

impl<T> InputPin for T where
    T: InputPin
[src]

type Error = ()

Error type

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> OutputPin for T where
    T: OutputPin
[src]

type Error = ()

Error type

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<W, S> Transfer<W> for S where
    S: Default<W>,
    W: Clone
[src]

type Error = <S as FullDuplex<W>>::Error

Error type

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<W, S> Write<W> for S where
    S: Default<W>,
    W: Clone
[src]

type Error = <S as FullDuplex<W>>::Error

Error type