Skip to main content

RxFrameIo

Trait RxFrameIo 

Source
pub trait RxFrameIo {
    type Frame;
    type Error;

    // Required methods
    fn recv(&mut self) -> Result<Self::Frame, Self::Error>;
    fn try_recv(&mut self) -> Result<Self::Frame, Self::Error>;
    fn recv_timeout(
        &mut self,
        timeout: Duration,
    ) -> Result<Self::Frame, Self::Error>;
    fn wait_not_empty(&mut self) -> Result<(), Self::Error>;
}
Expand description

Receive-side (blocking) CAN frame I/O.

This is the minimal interface a protocol needs to receive frames. You can implement it for a full CAN controller type, or for a dedicated “RX half” returned by SplitTxRx.

Required Associated Types§

Source

type Frame

The CAN frame type.

Source

type Error

Error returned by the driver implementation.

Required Methods§

Source

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

Receive a frame, blocking until one is available.

Source

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

Attempt to receive a frame without blocking.

When no frame is available, implementations typically return an error such as nb::Error::WouldBlock.

Source

fn recv_timeout( &mut self, timeout: Duration, ) -> Result<Self::Frame, Self::Error>

Receive a frame, waiting up to timeout.

Implementations that cannot support timeouts may treat this as RxFrameIo::recv.

Source

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

Wait until the receive queue is non-empty.

This can be used by polling-style protocols to avoid busy loops.

Implementors§