[][src]Struct embedded_hal_mock::serial::Transaction

pub struct Transaction<Word> { /* fields omitted */ }

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]

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]

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]

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

impl<Word> Send for Transaction<Word> where
    Word: Send

impl<Word> Sync for Transaction<Word> where
    Word: Sync

impl<Word> Unpin for Transaction<Word> where
    Word: Unpin

impl<Word> UnwindSafe for Transaction<Word> where
    Word: UnwindSafe

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, 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.