Skip to main content

BufferedIo

Trait BufferedIo 

Source
pub trait BufferedIo {
    type Frame;
    type Error;
    type Buffered<'a, const TX: usize, const RX: usize>
       where Self: 'a;

    // Required method
    fn buffered<'a, const TX: usize, const RX: usize>(
        &'a mut self,
        tx: &'a mut [Self::Frame; TX],
        rx: &'a mut [Self::Frame; RX],
    ) -> Self::Buffered<'a, TX, RX>;
}
Expand description

Buffered I/O wrapper creation.

This trait is for drivers that support adding host-side ring buffers around an underlying CAN device. This is common when the hardware has small mailboxes, but the host wants to smooth bursty traffic.

Required Associated Types§

Source

type Frame

The CAN frame type.

Source

type Error

Error returned by the driver implementation (typically forwarded from the underlying device).

Source

type Buffered<'a, const TX: usize, const RX: usize> where Self: 'a

Buffered wrapper type.

The wrapper usually borrows the driver and user-provided storage.

Required Methods§

Source

fn buffered<'a, const TX: usize, const RX: usize>( &'a mut self, tx: &'a mut [Self::Frame; TX], rx: &'a mut [Self::Frame; RX], ) -> Self::Buffered<'a, TX, RX>

Wrap the interface with host-side TX/RX ring buffers.

The backing storage is provided by the caller to avoid allocation and to make buffer sizes explicit in types.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§