Type Alias OptionsRaw

Source
pub type OptionsRaw<B, O> = RecordsRaw<B, O>;
Expand description

A not-yet-parsed sequence of options.

OptionsRaw represents a not-yet-parsed and not-yet-validated sequence of options, for example from an IPv4 or TCP header or an NDP packet. OptionsRaw uses RecordsRaw under the hood.

Aliased Type§

struct OptionsRaw<B, O> { /* private fields */ }

Implementations

Source§

impl<B, R> RecordsRaw<B, R>
where R: RecordsImplLayout<Context = ()>,

Source

pub fn new(bytes: B) -> Self

Creates a new RecordsRaw with the data in bytes.

Source§

impl<B, R> RecordsRaw<B, R>
where R: for<'a> RecordsRawImpl<'a>, B: SplitByteSlice,

Source

pub fn parse_raw_with_context<BV: BufferView<B>>( bytes: &mut BV, context: R::Context, ) -> MaybeParsed<Self, (B, R::Error)>

Raw-parses a sequence of records with a context.

See RecordsRaw::parse_raw_with_mut_context for details on bytes, context, and return value. parse_raw_with_context just calls parse_raw_with_mut_context with a mutable reference to the context which is passed by value to this function.

Source

pub fn parse_raw_with_mut_context<BV: BufferView<B>>( bytes: &mut BV, context: &mut R::Context, ) -> MaybeParsed<Self, (B, R::Error)>

Raw-parses a sequence of records with a mutable context.

parse_raw_with_mut_context shallowly parses bytes as a sequence of records. context may be used by implementers to maintain state.

parse_raw_with_mut_context performs a single pass over all of the records to be able to find the end of the records list and update bytes accordingly. Upon return with MaybeParsed::Complete, bytes will include only those bytes which are not part of the records list. Upon return with MaybeParsed::Incomplete, bytes will still contain the bytes which could not be parsed, and all subsequent bytes.

Source§

impl<B, R> RecordsRaw<B, R>
where R: for<'a> RecordsRawImpl<'a> + RecordsImplLayout<Context = ()>, B: SplitByteSlice,

Source

pub fn parse_raw<BV: BufferView<B>>( bytes: &mut BV, ) -> MaybeParsed<Self, (B, R::Error)>

Raw-parses a sequence of records.

Equivalent to calling RecordsRaw::parse_raw_with_context with context = ().

Source§

impl<B: Deref<Target = [u8]>, R: RecordsImplLayout> RecordsRaw<B, R>

Source

pub fn bytes(&self) -> &[u8]

Gets the underlying bytes.

bytes returns a reference to the byte slice backing this RecordsRaw.

Trait Implementations

Source§

impl<B: Debug, R: Debug + RecordsImplLayout> Debug for RecordsRaw<B, R>
where R::Context: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B, R> Deref for RecordsRaw<B, R>
where B: SplitByteSlice, R: RecordsImplLayout,

Source§

type Target = [u8]

The resulting type after dereferencing.
Source§

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

Dereferences the value.