[−][src]Struct embedded_hal_mock::serial::Mock
Mock serial device
The mock serial device can be loaded with expected transactions, then passed-on into a serial device user. If the expectations were not met in the specified order, the type causes a panic and describes what expectation wasn't met.
The type is clonable so that it may be shared with a serial
device user. Under the hood, both cloned mocks will share
the same state, allowing your handle to eventually call done()
,
if desired.
Implementations
impl<Word: Clone> Mock<Word>
[src]
pub fn new(transactions: &[Transaction<Word>]) -> Self
[src]
Create a serial mock that will expect the provided transactions
pub fn expect(&mut self, transactions: &[Transaction<Word>])
[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]
Asserts that all expectations up to this point were satisfied. Panics if there are unsatisfied expectations.
Trait Implementations
impl<Word: Clone> Clone for Mock<Word>
[src]
impl<Word> Default<Word> for Mock<Word> where
Word: PartialEq + Debug + Clone,
[src]
Word: PartialEq + Debug + Clone,
impl<Word> Read<Word> for Mock<Word> where
Word: Clone + Debug,
[src]
Word: Clone + Debug,
impl<Word> Write<Word> for Mock<Word> where
Word: PartialEq + Debug + Clone,
[src]
Word: PartialEq + Debug + Clone,
Auto Trait Implementations
impl<Word> RefUnwindSafe for Mock<Word>
impl<Word> Send for Mock<Word> where
Word: Send,
Word: Send,
impl<Word> Sync for Mock<Word> where
Word: Send,
Word: Send,
impl<Word> Unpin for Mock<Word>
impl<Word> UnwindSafe for Mock<Word>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, Word> Write<Word> for S where
S: Default<Word>,
Word: Clone,
[src]
S: Default<Word>,
Word: Clone,