[−][src]Struct embedded_hal_mock::serial::Transaction
A serial transaction
Transactions can either be reads, writes, or flushes. A collection of transactions represent the expected operations that are performed on your serial device.
Example
use embedded_hal_mock::serial::Transaction; use embedded_hal_mock::serial::Mock; // We expect, in order, // 1. A read that returns 0x23, // 2. A write of [0x55, 0xAA] // 3. A flush let transactions = [ Transaction::read(0x23), Transaction::write_many([0x55, 0xAA]), Transaction::flush() ]; let serial = Mock::new(&transactions);
Implementations
impl<Word> Transaction<Word> where
Word: Clone,
[src]
Word: Clone,
pub fn read(word: Word) -> Self
[src]
Expect a serial read that returns the expected word
pub fn read_many<Ws>(words: Ws) -> Self where
Ws: AsRef<[Word]>,
[src]
Ws: AsRef<[Word]>,
Expect a serial read that returns the expected words
pub fn read_error(error: Error<MockError>) -> Self
[src]
Expect a serial read that returns an error
pub fn write(word: Word) -> Self
[src]
Expect a serial write that transmits the specified word
pub fn write_many<Ws>(words: Ws) -> Self where
Ws: AsRef<[Word]>,
[src]
Ws: AsRef<[Word]>,
Expect a serial write that transmits the specified words
pub fn write_error(word: Word, error: Error<MockError>) -> Self
[src]
Expect a serial write that returns an error after transmitting the specified word
pub fn flush() -> Self
[src]
Expect a caller to flush the serial buffers
pub fn flush_error(error: Error<MockError>) -> Self
[src]
Expect a serial flush that returns an error
Auto Trait Implementations
impl<Word> RefUnwindSafe for Transaction<Word> where
Word: RefUnwindSafe,
Word: RefUnwindSafe,
impl<Word> Send for Transaction<Word> where
Word: Send,
Word: Send,
impl<Word> Sync for Transaction<Word> where
Word: Sync,
Word: Sync,
impl<Word> Unpin for Transaction<Word> where
Word: Unpin,
Word: Unpin,
impl<Word> UnwindSafe for Transaction<Word> where
Word: UnwindSafe,
Word: UnwindSafe,
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, 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>,