Struct packet::ParseMetadata
source · pub struct ParseMetadata { /* private fields */ }
Expand description
Metadata about a previously-parsed packet used to undo its parsing.
See GrowBuffer::undo_parse
for more details.
Implementations§
source§impl ParseMetadata
impl ParseMetadata
sourcepub fn from_packet(
header_len: usize,
body_len: usize,
footer_len: usize
) -> ParseMetadata
pub fn from_packet( header_len: usize, body_len: usize, footer_len: usize ) -> ParseMetadata
Constructs a new ParseMetadata
from information about a packet.
sourcepub fn from_inner_packet(len: usize) -> ParseMetadata
pub fn from_inner_packet(len: usize) -> ParseMetadata
Constructs a new ParseMetadata
from information about an inner packet.
Since inner packets do not have a header/body/footer distinction (at
least from the perspective of the utilities in this crate), we
arbitrarily produce a ParseMetadata
with a header length and no body
or footer lengths. Thus, from_inner_packet(len)
is equivalent to
from_packet(len, 0, 0)
.
sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Gets the header length.
header_len
returns the length of the header of the packet described by
this ParseMetadata
.
sourcepub fn body_len(&self) -> usize
pub fn body_len(&self) -> usize
Gets the body length.
body_len
returns the length of the body of the packet described by
this ParseMetadata
.
Gets the footer length.
footer_len
returns the length of the footer of the packet described by
this ParseMetadata
.
Trait Implementations§
source§impl Clone for ParseMetadata
impl Clone for ParseMetadata
source§fn clone(&self) -> ParseMetadata
fn clone(&self) -> ParseMetadata
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more