packet::records

Trait RecordsRawImpl

Source
pub trait RecordsRawImpl<'a>: RecordsImplLayout {
    // Required method
    fn parse_raw_with_context<BV: BufferView<&'a [u8]>>(
        data: &mut BV,
        context: &mut Self::Context,
    ) -> Result<bool, Self::Error>;
}
Expand description

An implementation of a raw records parser.

RecordsRawImpl provides functions to raw-parse sequential records. It is required to construct a partially-parsed RecordsRaw.

RecordsRawImpl is meant to perform little or no validation on each record it consumes. It is primarily used to be able to walk record sequences with unknown lengths.

Required Methods§

Source

fn parse_raw_with_context<BV: BufferView<&'a [u8]>>( data: &mut BV, context: &mut Self::Context, ) -> Result<bool, Self::Error>

Raw-parses a single record with some context.

parse_raw_with_context takes a variable length data and a context to maintain state, and returns Ok(true) if a record is successfully consumed, Ok(false) if it is unable to parse more records, and Err(err) if the data is malformed in any way.

data may be empty. It is up to the implementer to handle an exhausted data.

It’s the implementer’s responsibility to consume exactly one record from data when returning Ok(_).

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§