ArbitrarySpiBus

Struct ArbitrarySpiBus 

Source
pub struct ArbitrarySpiBus<Word> { /* private fields */ }
Expand description

Creates a fuzzed SpiBus, this type is intended to be constructed the arbitrary crate e.g.

use arbitrary::{Arbitrary, Unstructured};
use embedded_hal_fuzz::spi::ArbitrarySpiBus;
let raw_fuzzed_data = &[1u8, 2, 3, 4, 5][..];
let mut unstructured = Unstructured::new(raw_fuzzed_data);
let spi_bus = ArbitrarySpiBus::<u8>::arbitrary(&mut unstructured);

Trait Implementations§

Source§

impl<'arbitrary, Word: Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for ArbitrarySpiBus<Word>

Source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<Word: Debug> Debug for ArbitrarySpiBus<Word>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Word> ErrorType for ArbitrarySpiBus<Word>

Source§

type Error = Error

Error type.
Source§

impl<Word: Copy + 'static> SpiBus<Word> for ArbitrarySpiBus<Word>

Source§

fn read(&mut self, words: &mut [Word]) -> Result<(), Self::Error>

Read words from the slave. Read more
Source§

fn write(&mut self, _words: &[Word]) -> Result<(), Self::Error>

Write words to the slave, ignoring all the incoming words. Read more
Source§

fn transfer( &mut self, read: &mut [Word], _write: &[Word], ) -> Result<(), Self::Error>

Write and read simultaneously. write is written to the slave on MOSI and words received on MISO are stored in read. Read more
Source§

fn transfer_in_place(&mut self, words: &mut [Word]) -> Result<(), Self::Error>

Write and read simultaneously. The contents of words are written to the slave, and the received words are stored into the same words buffer, overwriting it. Read more
Source§

fn flush(&mut self) -> Result<(), Self::Error>

Wait until all operations have completed and the bus is idle. Read more

Auto Trait Implementations§

§

impl<Word> Freeze for ArbitrarySpiBus<Word>

§

impl<Word> RefUnwindSafe for ArbitrarySpiBus<Word>
where Word: RefUnwindSafe,

§

impl<Word> Send for ArbitrarySpiBus<Word>
where Word: Send,

§

impl<Word> Sync for ArbitrarySpiBus<Word>
where Word: Sync,

§

impl<Word> Unpin for ArbitrarySpiBus<Word>
where Word: Unpin,

§

impl<Word> UnwindSafe for ArbitrarySpiBus<Word>
where Word: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.