#[non_exhaustive]pub enum ResponseCode {
NoError,
FormatError,
ServerFailure,
NameError,
NotImplemented,
Refused,
Unknown(u8),
}Expand description
DNS response code. mDNS requires ResponseCode::NoError in both queries
and responses; other values are kept for round-trip correctness.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoError
No error (0).
FormatError
Format error (1).
ServerFailure
Server failure (2).
NameError
Name error (3, “NXDOMAIN”).
NotImplemented
Not implemented (4).
Refused
Refused (5).
Unknown(u8)
Lossless escape for unknown response codes.
Implementations§
Source§impl ResponseCode
impl ResponseCode
Sourcepub const fn is_no_error(&self) -> bool
pub const fn is_no_error(&self) -> bool
Returns true if this value is of type NoError. Returns false otherwise
Sourcepub const fn is_format_error(&self) -> bool
pub const fn is_format_error(&self) -> bool
Returns true if this value is of type FormatError. Returns false otherwise
Sourcepub const fn is_server_failure(&self) -> bool
pub const fn is_server_failure(&self) -> bool
Returns true if this value is of type ServerFailure. Returns false otherwise
Sourcepub const fn is_name_error(&self) -> bool
pub const fn is_name_error(&self) -> bool
Returns true if this value is of type NameError. Returns false otherwise
Sourcepub const fn is_not_implemented(&self) -> bool
pub const fn is_not_implemented(&self) -> bool
Returns true if this value is of type NotImplemented. Returns false otherwise
Sourcepub const fn is_refused(&self) -> bool
pub const fn is_refused(&self) -> bool
Returns true if this value is of type Refused. Returns false otherwise
Sourcepub const fn is_unknown(&self) -> bool
pub const fn is_unknown(&self) -> bool
Returns true if this value is of type Unknown. Returns false otherwise
Source§impl ResponseCode
impl ResponseCode
Sourcepub fn unwrap_no_error(self)
pub fn unwrap_no_error(self)
Unwraps this value to the ResponseCode::NoError variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_format_error(self)
pub fn unwrap_format_error(self)
Unwraps this value to the ResponseCode::FormatError variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_server_failure(self)
pub fn unwrap_server_failure(self)
Unwraps this value to the ResponseCode::ServerFailure variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_name_error(self)
pub fn unwrap_name_error(self)
Unwraps this value to the ResponseCode::NameError variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_not_implemented(self)
pub fn unwrap_not_implemented(self)
Unwraps this value to the ResponseCode::NotImplemented variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_refused(self)
pub fn unwrap_refused(self)
Unwraps this value to the ResponseCode::Refused variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_unknown(self) -> u8
pub fn unwrap_unknown(self) -> u8
Unwraps this value to the ResponseCode::Unknown variant.
Panics if this value is of any other type.
Source§impl ResponseCode
impl ResponseCode
Sourcepub fn try_unwrap_no_error(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_no_error(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the ResponseCode::NoError variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_format_error(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_format_error(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the ResponseCode::FormatError variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_server_failure(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_server_failure(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the ResponseCode::ServerFailure variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_name_error(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_name_error(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the ResponseCode::NameError variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_not_implemented(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_not_implemented(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the ResponseCode::NotImplemented variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_refused(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_refused(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the ResponseCode::Refused variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_unknown(self) -> Result<u8, TryUnwrapError<Self>>
pub fn try_unwrap_unknown(self) -> Result<u8, TryUnwrapError<Self>>
Attempts to unwrap this value to the ResponseCode::Unknown variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Source§impl ResponseCode
impl ResponseCode
Trait Implementations§
Source§impl Clone for ResponseCode
impl Clone for ResponseCode
Source§fn clone(&self) -> ResponseCode
fn clone(&self) -> ResponseCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ResponseCode
Source§impl Debug for ResponseCode
impl Debug for ResponseCode
Source§impl Display for ResponseCode
impl Display for ResponseCode
impl Eq for ResponseCode
Source§impl Hash for ResponseCode
impl Hash for ResponseCode
Source§impl Ord for ResponseCode
impl Ord for ResponseCode
Source§fn cmp(&self, other: &ResponseCode) -> Ordering
fn cmp(&self, other: &ResponseCode) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ResponseCode
impl PartialEq for ResponseCode
Source§fn eq(&self, other: &ResponseCode) -> bool
fn eq(&self, other: &ResponseCode) -> bool
self and other values to be equal, and is used by ==.