Trait packet::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.

Object Safety§

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>