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
§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 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 for HeaderSection
impl PartialEq for HeaderSection
impl Copy for HeaderSection
impl Eq for HeaderSection
impl StructuralPartialEq for HeaderSection
Auto Trait Implementations§
impl Freeze for HeaderSection
impl RefUnwindSafe for HeaderSection
impl Send for HeaderSection
impl Sync for HeaderSection
impl Unpin for HeaderSection
impl UnwindSafe for HeaderSection
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)