Struct embedded_hal_compat::Forward

source ·
pub struct Forward<T, M = ()> { /* private fields */ }
Expand description

Forward compatibility container object. This is generic over different E-H types and will provide adaption depending on the bound type.

Implementations§

source§

impl<T, M> Forward<T, M>

source

pub fn new(inner: T) -> Forward<T, M>

Create a new compatibility wrapper object

source

pub fn inner(&self) -> &T

Fetch a reference to the wrapped object

source

pub fn inner_mut(&mut self) -> &mut T

Fetch a mutable reference to the wrapped object

source

pub fn unwrap(self) -> T

Destroy the compatibility wrapper, returning the wrapped object

Trait Implementations§

source§

impl<T> DelayNs for Forward<T>
where T: DelayUs<u32>,

source§

fn delay_ns(&mut self, ns: u32)

Pauses execution for at minimum ns nanoseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

fn delay_us(&mut self, us: u32)

Pauses execution for at minimum us microseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for at minimum ms milliseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

impl<T, E> ErrorType for Forward<T>
where T: Transfer<u8, Error = E>, E: Debug,

§

type Error = ForwardError<E>

Error type.
source§

impl<T, E> ErrorType for Forward<T>
where T: Write<u8, Error = E>, E: Debug,

Available on crate feature embedded-io only.
§

type Error = ForwardError<E>

Error type of all the IO operations on this type.
source§

impl<T, E> ErrorType for Forward<T>
where T: Read<Error = E>, E: Debug,

§

type Error = ForwardError<E>

Error type
source§

impl<T, E> ErrorType for Forward<T, ForwardInputPin>
where T: InputPin<Error = E>, E: Debug,

§

type Error = ForwardError<E>

Error type
source§

impl<T, E> ErrorType for Forward<T, ForwardIoPin>
where T: OutputPin<Error = E> + InputPin<Error = E>, E: Debug,

§

type Error = ForwardError<E>

Error type
source§

impl<T, E> ErrorType for Forward<T, ForwardOutputPin>
where T: OutputPin<Error = E>, E: Debug,

§

type Error = ForwardError<E>

Error type
source§

impl<T, E> I2c for Forward<T>
where T: Write<Error = E> + WriteIter<Error = E> + Read<Error = E> + WriteRead<Error = E> + WriteIterRead<Error = E> + Transactional<Error = E> + TransactionalIter<Error = E>, E: Debug,

source§

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

Reads enough bytes from slave with address to fill read. Read more
source§

fn write( &mut self, address: SevenBitAddress, words: &[u8] ) -> Result<(), Self::Error>

Writes bytes to slave with address address. Read more
source§

fn write_read( &mut self, address: SevenBitAddress, bytes: &[u8], buffer: &mut [u8] ) -> Result<(), Self::Error>

Writes bytes to slave with address address and then reads enough bytes to fill read in a single transaction. Read more
source§

fn transaction( &mut self, address: SevenBitAddress, operations: &mut [Operation<'_>] ) -> Result<(), Self::Error>

Execute the provided operations on the I2C bus. Read more
source§

impl<T, E> InputPin for Forward<T, ForwardInputPin>
where T: InputPin<Error = E>, E: Debug,

source§

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

Is the input pin high?

source§

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

Is the input pin low?

source§

impl<T, E> InputPin for Forward<T, ForwardIoPin>
where T: InputPin<Error = E> + OutputPin<Error = E>, E: Debug,

source§

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

Is the input pin high?

source§

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

Is the input pin low?

source§

impl<T, E> OutputPin for Forward<T, ForwardIoPin>
where T: InputPin<Error = E> + OutputPin<Error = E>, E: Debug,

source§

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

Set the output as high

source§

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

Set the output as low

source§

fn set_state(&mut self, state: PinState) -> Result<(), Self::Error>

Drives the pin high or low depending on the provided value. Read more
source§

impl<T, E> OutputPin for Forward<T, ForwardOutputPin>
where T: OutputPin<Error = E>, E: Debug,

source§

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

Set the output as high

source§

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

Set the output as low

source§

fn set_state(&mut self, state: PinState) -> Result<(), Self::Error>

Drives the pin high or low depending on the provided value. Read more
source§

impl<T, E> SpiBus for Forward<T>
where T: Transfer<u8, Error = E> + Write<u8, Error = E>, E: Debug,

source§

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

Read words from the slave. Read more
source§

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

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

fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> 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 [u8]) -> 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
source§

impl<T, E> Write for Forward<T>
where T: Write<u8, Error = E>, E: Debug,

Available on crate feature embedded-io only.
source§

fn write(&mut self, words: &[u8]) -> Result<usize, Self::Error>

Write a buffer into this writer, returning how many bytes were written. Read more
source§

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

Flush this output stream, blocking until all intermediately buffered contents reach their destination.
source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer. Read more
source§

fn write_fmt( &mut self, fmt: Arguments<'_> ) -> Result<(), WriteFmtError<Self::Error>>

Write a formatted string into this writer, returning any error encountered. Read more

Auto Trait Implementations§

§

impl<T, M> Freeze for Forward<T, M>
where T: Freeze,

§

impl<T, M> RefUnwindSafe for Forward<T, M>

§

impl<T, M> Send for Forward<T, M>
where T: Send, M: Send,

§

impl<T, M> Sync for Forward<T, M>
where T: Sync, M: Sync,

§

impl<T, M> Unpin for Forward<T, M>
where T: Unpin, M: Unpin,

§

impl<T, M> UnwindSafe for Forward<T, M>
where T: UnwindSafe, M: 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, M> ForwardCompat<T, M> for T

source§

fn forward(self) -> Forward<T, M>

Create an e-h-c forward compatibility wrapper around and e-h object Available methods depend on the wrapped type
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> ReverseCompat<T> for T

source§

fn reverse(self) -> Reverse<T>

Create an e-h-c wrapper around and e-h object Available methods depend on the wrapped type

source§

fn reverse_cell(self) -> Reverse<RefCell<T>>

Create an e-h-c reverse compatibility wrapper using a ref-cell for interior mutability (required for InputPin types)

source§

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

§

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

§

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.