pub struct ExtendedError<Octs> { /* private fields */ }
Expand description
Option data for an extended DNS error.
The Extended DNS Error option allows a server to include more detailed
information in a response to a failed query why it did. It contains a
standardized ExtendedErrorCode
for machines and an optional UTF-8
error text for humans.
Implementations§
source§impl<Octs> ExtendedError<Octs>
impl<Octs> ExtendedError<Octs>
sourcepub fn new(
code: ExtendedErrorCode,
text: Option<Str<Octs>>,
) -> Result<Self, LongOptData>
pub fn new( code: ExtendedErrorCode, text: Option<Str<Octs>>, ) -> Result<Self, LongOptData>
Creates a new value from a code and optional text.
Returns an error if text
is present but is too long to fit into
an option.
sourcepub unsafe fn new_unchecked(
code: ExtendedErrorCode,
text: Option<Result<Str<Octs>, Octs>>,
) -> Self
pub unsafe fn new_unchecked( code: ExtendedErrorCode, text: Option<Result<Str<Octs>, Octs>>, ) -> Self
Creates a new value without checking for the option length.
§Safety
The caller must ensure that the length of the wire format of the value does not exceed 65,535 octets.
sourcepub fn code(&self) -> ExtendedErrorCode
pub fn code(&self) -> ExtendedErrorCode
Returns the error code.
sourcepub fn text(&self) -> Option<Result<&Str<Octs>, &Octs>>
pub fn text(&self) -> Option<Result<&Str<Octs>, &Octs>>
Returns the text.
If there is no text, returns None
. If there is text and it is
correctly encoded UTF-8, returns Some(Ok(_))
. If there is text but
it is not UTF-8, returns Some(Err(_))
.
sourcepub fn text_slice(&self) -> Option<&[u8]>
pub fn text_slice(&self) -> Option<&[u8]>
Returns the text as an octets slice.
sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Returns true if the code is in the private range.
pub fn parse<'a, Src: Octets<Range<'a> = Octs> + ?Sized>( parser: &mut Parser<'a, Src>, ) -> Result<Self, ParseError>
Trait Implementations§
source§impl<Octs: Clone> Clone for ExtendedError<Octs>
impl<Octs: Clone> Clone for ExtendedError<Octs>
source§fn clone(&self) -> ExtendedError<Octs>
fn clone(&self) -> ExtendedError<Octs>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Octs: AsRef<[u8]>> ComposeOptData for ExtendedError<Octs>
impl<Octs: AsRef<[u8]>> ComposeOptData for ExtendedError<Octs>
fn compose_len(&self) -> u16
fn compose_option<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
source§impl<Octs, Name> From<ExtendedError<Octs>> for AllOptData<Octs, Name>
impl<Octs, Name> From<ExtendedError<Octs>> for AllOptData<Octs, Name>
source§fn from(value: ExtendedError<Octs>) -> Self
fn from(value: ExtendedError<Octs>) -> Self
source§impl<Octs> From<ExtendedErrorCode> for ExtendedError<Octs>
impl<Octs> From<ExtendedErrorCode> for ExtendedError<Octs>
source§fn from(code: ExtendedErrorCode) -> Self
fn from(code: ExtendedErrorCode) -> Self
source§impl<Octs> From<u16> for ExtendedError<Octs>
impl<Octs> From<u16> for ExtendedError<Octs>
source§impl<Octs> OptData for ExtendedError<Octs>
impl<Octs> OptData for ExtendedError<Octs>
source§fn code(&self) -> OptionCode
fn code(&self) -> OptionCode
source§impl<'a, Octs> ParseOptData<'a, Octs> for ExtendedError<Octs::Range<'a>>
impl<'a, Octs> ParseOptData<'a, Octs> for ExtendedError<Octs::Range<'a>>
source§fn parse_option(
code: OptionCode,
parser: &mut Parser<'a, Octs>,
) -> Result<Option<Self>, ParseError>
fn parse_option( code: OptionCode, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>
source§impl<Octs, Other> PartialEq<ExtendedError<Other>> for ExtendedError<Octs>
impl<Octs, Other> PartialEq<ExtendedError<Other>> for ExtendedError<Octs>
source§impl<Octs> TryFrom<(ExtendedErrorCode, Str<Octs>)> for ExtendedError<Octs>
impl<Octs> TryFrom<(ExtendedErrorCode, Str<Octs>)> for ExtendedError<Octs>
§type Error = LongOptData
type Error = LongOptData
impl<Octs: AsRef<[u8]>> Eq for ExtendedError<Octs>
Auto Trait Implementations§
impl<Octs> Freeze for ExtendedError<Octs>where
Octs: Freeze,
impl<Octs> RefUnwindSafe for ExtendedError<Octs>where
Octs: RefUnwindSafe,
impl<Octs> Send for ExtendedError<Octs>where
Octs: Send,
impl<Octs> Sync for ExtendedError<Octs>where
Octs: Sync,
impl<Octs> Unpin for ExtendedError<Octs>where
Octs: Unpin,
impl<Octs> UnwindSafe for ExtendedError<Octs>where
Octs: UnwindSafe,
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
)