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§
Required Methods§
Sourcefn buffer_mut(&mut self) -> &mut [u8] ⓘ
fn buffer_mut(&mut self) -> &mut [u8] ⓘ
Returns a mutable reference to the internal buffer for the coding layer to write received data into.
Sourcefn feed(&mut self, len: usize) -> Result<(), Self::Error>
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.
Sourcefn data_field(&self) -> &[u8] ⓘ
fn data_field(&self) -> &[u8] ⓘ
Returns the data field of the most recently fed frame.
Returns an empty slice before the first feed() call.