Struct domain::base::header::HeaderSection
source · 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
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
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
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 moresource§impl Debug for HeaderSection
impl Debug for HeaderSection
source§impl Default for HeaderSection
impl Default for HeaderSection
source§fn default() -> HeaderSection
fn default() -> HeaderSection
source§impl PartialEq<HeaderSection> for HeaderSection
impl PartialEq<HeaderSection> for HeaderSection
source§fn eq(&self, other: &HeaderSection) -> bool
fn eq(&self, other: &HeaderSection) -> bool
self
and other
values to be equal, and is used
by ==
.