Skip to main content

FrameRead

Trait FrameRead 

Source
pub trait FrameRead {
    type Error;

    // Required methods
    fn buffer_mut(&mut self) -> &mut [u8] ;
    fn feed(&mut self, len: usize) -> Result<(), Self::Error>;
    fn data_field(&self) -> &[u8] ;
}
Expand description

Extracts the data field from a received transfer frame.

Owns the frame buffer internally. buffer_mut() provides write access for the coding layer to fill. feed() validates the header. data_field() returns the raw data field — packet extraction is handled by DatalinkReader.

Required Associated Types§

Source

type Error

Error type for frame parsing.

Required Methods§

Source

fn buffer_mut(&mut self) -> &mut [u8]

Returns a mutable reference to the internal buffer for the coding layer to write received data into.

Source

fn feed(&mut self, len: usize) -> Result<(), Self::Error>

Validate the frame header for len bytes of data in the buffer and prepare for data field access.

Source

fn data_field(&self) -> &[u8]

Returns the data field of the most recently fed frame.

Returns an empty slice before the first feed() call.

Implementors§