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.
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.