Skip to main content

HeaderSection

Struct 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

§Creation and Conversion

Source

pub fn new() -> HeaderSection

Creates a new header section.

The value will have all header and header counts fields set to zero or false.

Source

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.

Source

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

pub fn as_slice(&self) -> &[u8]

Returns a reference to the underlying octets slice.

Source§

impl HeaderSection

§Access to Header and Counts

Source

pub fn header(&self) -> &Header

Returns a reference to the header.

Source

pub fn header_mut(&mut self) -> &mut Header

Returns a mutable reference to the header.

Source

pub fn counts(&self) -> &HeaderCounts

Returns a reference to the header counts.

Source

pub fn counts_mut(&mut self) -> &mut HeaderCounts

Returns a mutable reference to the header counts.

Source§

impl HeaderSection

§Parsing and Composing

Source

pub fn parse<Octs>( parser: &mut Parser<'_, Octs>, ) -> Result<HeaderSection, ParseError>
where Octs: AsRef<[u8]>,

Source

pub fn compose<Target>( &self, target: &mut Target, ) -> Result<(), <Target as OctetsBuilder>::AppendError>
where Target: OctetsBuilder + ?Sized,

Trait Implementations§

Source§

impl AsMut<Header> for HeaderSection

Source§

fn as_mut(&mut self) -> &mut Header

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsMut<HeaderCounts> for HeaderSection

Source§

fn as_mut(&mut self) -> &mut HeaderCounts

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<Header> for HeaderSection

Source§

fn as_ref(&self) -> &Header

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<HeaderCounts> for HeaderSection

Source§

fn as_ref(&self) -> &HeaderCounts

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for HeaderSection

Source§

fn clone(&self) -> HeaderSection

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for HeaderSection

Source§

impl Debug for HeaderSection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for HeaderSection

Source§

fn default() -> HeaderSection

Returns the “default value” for a type. Read more
Source§

impl Eq for HeaderSection

Source§

impl PartialEq for HeaderSection

Source§

fn eq(&self, other: &HeaderSection) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for HeaderSection

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

Source§

type Error = <Target as OctetsFrom<Source>>::Error

Source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
Source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.