packet

Trait Buffer

Source
pub trait Buffer: GrowBuffer + ParseBuffer {
    // Required method
    fn parse_with_view<'a, ParseArgs, P: ParsablePacket<&'a [u8], ParseArgs>>(
        &'a mut self,
        args: ParseArgs,
    ) -> Result<(P, &'a [u8]), P::Error>;
}
Expand description

A byte buffer used for parsing that can grow back to its original size.

Buffer owns its backing memory and so implies GrowBuffer + ParseBuffer. A Buffer can be used for parsing (via ParseBuffer) and then grow back to its original size (via GrowBuffer). Since it owns the backing memory, it also provides the ability to provide both a parsed and un-parsed view into a packet via Buffer::parse_with_view.

Required Methods§

Source

fn parse_with_view<'a, ParseArgs, P: ParsablePacket<&'a [u8], ParseArgs>>( &'a mut self, args: ParseArgs, ) -> Result<(P, &'a [u8]), P::Error>

Like ParseBuffer::parse_with but additionally provides an un-structured view into the parsed data on successful parsing.

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§

Source§

impl Buffer for EmptyBuf

Source§

impl<A, B> Buffer for Either<A, B>
where A: Buffer, B: Buffer,

Source§

impl<B: AsRef<[u8]>> Buffer for Buf<B>