pub struct Header { /* private fields */ }Expand description
DNS message header.
Implementations§
Source§impl Header
impl Header
Sourcepub fn flags_mut(&mut self) -> &mut Flags
pub fn flags_mut(&mut self) -> &mut Flags
Returns a mutable reference to the flags for in-place modification.
Sourcepub const fn question_count(&self) -> u16
pub const fn question_count(&self) -> u16
Returns the number of questions.
Sourcepub const fn answer_count(&self) -> u16
pub const fn answer_count(&self) -> u16
Returns the number of answer records.
Returns the number of authority records.
Sourcepub const fn additional_count(&self) -> u16
pub const fn additional_count(&self) -> u16
Returns the number of additional records.
Sourcepub const fn set_question_count(&mut self, v: u16) -> &mut Header
pub const fn set_question_count(&mut self, v: u16) -> &mut Header
Sets the number of questions.
Sourcepub const fn set_answer_count(&mut self, v: u16) -> &mut Header
pub const fn set_answer_count(&mut self, v: u16) -> &mut Header
Sets the number of answer records.
Sets the number of authority records.
Sourcepub const fn set_additional_count(&mut self, v: u16) -> &mut Header
pub const fn set_additional_count(&mut self, v: u16) -> &mut Header
Sets the number of additional records.
Sourcepub const fn with_flags(self, v: Flags) -> Header
pub const fn with_flags(self, v: Flags) -> Header
Returns a header with the flags set.
Sourcepub const fn with_question_count(self, v: u16) -> Header
pub const fn with_question_count(self, v: u16) -> Header
Returns a header with the number of questions set.
Sourcepub const fn with_answer_count(self, v: u16) -> Header
pub const fn with_answer_count(self, v: u16) -> Header
Returns a header with the number of answer records set.
Returns a header with the number of authority records set.
Sourcepub const fn with_additional_count(self, v: u16) -> Header
pub const fn with_additional_count(self, v: u16) -> Header
Returns a header with the number of additional records set.
Sourcepub fn try_parse(buf: &[u8]) -> Result<(Header, &[u8]), ParseError>
pub fn try_parse(buf: &[u8]) -> Result<(Header, &[u8]), ParseError>
Parse a 12-byte DNS header from the start of buf. Returns the header
and a slice of the bytes following it.
Sourcepub fn write(&self, out: &mut [u8]) -> Result<usize, EncodeError>
pub fn write(&self, out: &mut [u8]) -> Result<usize, EncodeError>
Write a 12-byte DNS header into the start of out. Returns the number
of bytes written (always HEADER_SIZE on success).
Trait Implementations§
impl Copy for Header
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnsafeUnpin for Header
impl UnwindSafe for Header
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more