pub struct Flags { /* private fields */ }Expand description
Packed 16-bit DNS header flags field.
Implementations§
Source§impl Flags
impl Flags
Sourcepub const fn is_response(&self) -> bool
pub const fn is_response(&self) -> bool
true if this is a response (QR bit set).
true if authoritative answer.
Sourcepub const fn is_truncated(&self) -> bool
pub const fn is_truncated(&self) -> bool
true if truncated (TC bit).
Sourcepub const fn is_recursion_desired(&self) -> bool
pub const fn is_recursion_desired(&self) -> bool
true if recursion desired (RD bit).
Sourcepub const fn is_recursion_available(&self) -> bool
pub const fn is_recursion_available(&self) -> bool
true if recursion available (RA bit).
Sourcepub const fn response_code(&self) -> ResponseCode
pub const fn response_code(&self) -> ResponseCode
Response code (4 bits).
Sourcepub const fn set_response(&mut self) -> &mut Flags
pub const fn set_response(&mut self) -> &mut Flags
Sets the QR bit (this is a response).
Sourcepub const fn with_response(self) -> Flags
pub const fn with_response(self) -> Flags
Same as Self::set_response but consuming.
Sourcepub const fn clear_response(&mut self) -> &mut Flags
pub const fn clear_response(&mut self) -> &mut Flags
Clears the QR bit (this is a query).
Sourcepub const fn set_opcode(&mut self, op: Opcode) -> &mut Flags
pub const fn set_opcode(&mut self, op: Opcode) -> &mut Flags
Sets the opcode.
Sourcepub const fn with_opcode(self, op: Opcode) -> Flags
pub const fn with_opcode(self, op: Opcode) -> Flags
Consuming version of Self::set_opcode.
Sets the AA bit (authoritative answer).
Consuming version.
Clears the AA bit.
Sourcepub const fn set_truncated(&mut self) -> &mut Flags
pub const fn set_truncated(&mut self) -> &mut Flags
Sets the TC bit.
Sourcepub const fn with_truncated(self) -> Flags
pub const fn with_truncated(self) -> Flags
Consuming version.
Sourcepub const fn clear_truncated(&mut self) -> &mut Flags
pub const fn clear_truncated(&mut self) -> &mut Flags
Clears the TC bit.
Sourcepub const fn set_response_code(&mut self, rc: ResponseCode) -> &mut Flags
pub const fn set_response_code(&mut self, rc: ResponseCode) -> &mut Flags
Sets the response code.
Sourcepub const fn with_response_code(self, rc: ResponseCode) -> Flags
pub const fn with_response_code(self, rc: ResponseCode) -> Flags
Consuming version.
Trait Implementations§
impl Copy for Flags
impl Eq for Flags
impl StructuralPartialEq for Flags
Auto Trait Implementations§
impl Freeze for Flags
impl RefUnwindSafe for Flags
impl Send for Flags
impl Sync for Flags
impl Unpin for Flags
impl UnsafeUnpin for Flags
impl UnwindSafe for Flags
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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