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§
sourcefn parse_with_view<'a, ParseArgs, P: ParsablePacket<&'a [u8], ParseArgs>>(
&'a mut self,
args: ParseArgs,
) -> Result<(P, &'a [u8]), P::Error>
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.