pub struct HeaderSection { /* private fields */ }
Expand description
The complete header section of a DNS message.
Consists of a Header
directly followed by a HeaderCounts
.
You can create an owned value via the new
function or the
Default
trait and acquire a pointer referring the the header section of
an existing DNS message via the
for_message_slice
or
for_message_slice_mut
functions.
Implementations§
Source§impl HeaderSection
impl HeaderSection
§Creation and Conversion
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new header section.
The value will have all header and header counts fields set to zero or false.
Sourcepub fn for_message_slice(s: &[u8]) -> &HeaderSection
pub fn for_message_slice(s: &[u8]) -> &HeaderSection
Creates a reference from the octets slice of a message.
§Panics
This function panics if the octets slice is shorter than 12 octets.
Sourcepub fn for_message_slice_mut(s: &mut [u8]) -> &mut HeaderSection
pub fn for_message_slice_mut(s: &mut [u8]) -> &mut HeaderSection
Creates a mutable reference from the octets slice of a message.
§Panics
This function panics if the octets slice is shorter than 12 octets.
Source§impl HeaderSection
impl HeaderSection
§Access to Header and Counts
Sourcepub fn header_mut(&mut self) -> &mut Header
pub fn header_mut(&mut self) -> &mut Header
Returns a mutable reference to the header.
Sourcepub fn counts(&self) -> &HeaderCounts
pub fn counts(&self) -> &HeaderCounts
Returns a reference to the header counts.
Sourcepub fn counts_mut(&mut self) -> &mut HeaderCounts
pub fn counts_mut(&mut self) -> &mut HeaderCounts
Returns a mutable reference to the header counts.
Source§impl HeaderSection
impl HeaderSection
§Parsing and Composing
pub fn parse<Octs: AsRef<[u8]>>( parser: &mut Parser<'_, Octs>, ) -> Result<Self, ParseError>
pub fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
Trait Implementations§
Source§impl AsMut<Header> for HeaderSection
impl AsMut<Header> for HeaderSection
Source§impl AsMut<HeaderCounts> for HeaderSection
impl AsMut<HeaderCounts> for HeaderSection
Source§fn as_mut(&mut self) -> &mut HeaderCounts
fn as_mut(&mut self) -> &mut HeaderCounts
Source§impl AsRef<Header> for HeaderSection
impl AsRef<Header> for HeaderSection
Source§impl AsRef<HeaderCounts> for HeaderSection
impl AsRef<HeaderCounts> for HeaderSection
Source§fn as_ref(&self) -> &HeaderCounts
fn as_ref(&self) -> &HeaderCounts
Source§impl Clone for HeaderSection
impl Clone for HeaderSection
Source§fn clone(&self) -> HeaderSection
fn clone(&self) -> HeaderSection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more