pub struct MessageSlicer<'de> { /* private fields */ }Expand description
MessageSlicer wraps a Slicer to provide:
- Methods to parse fields because we already know the fixed length of those fields.
- A validated input. We know a Message must be a minimum length because we know the size of certain fields. This allows us to use faster unchecked parsing if we check the length at instantiation.
MessageSlicer is useful to implement from_bytes from DecodeMessage.
Implementations§
Source§impl<'de> MessageSlicer<'de>
impl<'de> MessageSlicer<'de>
Sourcepub fn parse_htype(&self) -> &'de [u8] ⓘ
pub fn parse_htype(&self) -> &'de [u8] ⓘ
Parses 1 byte to be used for the htype field
Sourcepub fn parse_hlen(&self) -> &'de [u8] ⓘ
pub fn parse_hlen(&self) -> &'de [u8] ⓘ
Parses 1 byte to be used for the hlen field
Sourcepub fn parse_hops(&self) -> &'de [u8] ⓘ
pub fn parse_hops(&self) -> &'de [u8] ⓘ
Parses 1 byte to be used for the hops field
Sourcepub fn parse_secs(&self) -> &'de [u8] ⓘ
pub fn parse_secs(&self) -> &'de [u8] ⓘ
Parses 2 bytes to be used for the secs field
Sourcepub fn parse_flags(&self) -> &'de [u8] ⓘ
pub fn parse_flags(&self) -> &'de [u8] ⓘ
Parses 2 bytes to be used for the flags field
Sourcepub fn parse_ciaddr(&self) -> &'de [u8] ⓘ
pub fn parse_ciaddr(&self) -> &'de [u8] ⓘ
Parses 4 bytes to be used for the ciaddr field
Sourcepub fn parse_yiaddr(&self) -> &'de [u8] ⓘ
pub fn parse_yiaddr(&self) -> &'de [u8] ⓘ
Parses 4 bytes to be used for the yiaddr field
Sourcepub fn parse_siaddr(&self) -> &'de [u8] ⓘ
pub fn parse_siaddr(&self) -> &'de [u8] ⓘ
Parses 4 bytes to be used for the siaddr field
Sourcepub fn parse_giaddr(&self) -> &'de [u8] ⓘ
pub fn parse_giaddr(&self) -> &'de [u8] ⓘ
Parses 4 bytes to be used for the giaddr field
Sourcepub fn parse_chaddr(&self) -> &'de [u8] ⓘ
pub fn parse_chaddr(&self) -> &'de [u8] ⓘ
Parses 16 bytes to be used for the chaddr field
Sourcepub fn parse_sname(&self) -> &'de [u8] ⓘ
pub fn parse_sname(&self) -> &'de [u8] ⓘ
Parses 64 bytes to be used for the sname field
Sourcepub fn parse_file(&self) -> &'de [u8] ⓘ
pub fn parse_file(&self) -> &'de [u8] ⓘ
Parses 128 bytes to be used for the file field
Sourcepub fn parse_magic(&self) -> &'de [u8] ⓘ
pub fn parse_magic(&self) -> &'de [u8] ⓘ
Parses 4 bytes to be used as the magic field
Sourcepub fn parse_options(&self) -> &'de [u8] ⓘ
pub fn parse_options(&self) -> &'de [u8] ⓘ
Parses all remaining bytes in the input to be used as the options field