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§
Required Methods§
Sourcefn recv(&mut self) -> Result<Self::Frame, Self::Error>
fn recv(&mut self) -> Result<Self::Frame, Self::Error>
Receive a frame, blocking until one is available.
Sourcefn try_recv(&mut self) -> Result<Self::Frame, Self::Error>
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.
Sourcefn recv_timeout(
&mut self,
timeout: Duration,
) -> Result<Self::Frame, Self::Error>
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.
Sourcefn wait_not_empty(&mut self) -> Result<(), Self::Error>
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.