Struct domain::base::opt::exterr::ExtendedError

source ·
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>

source

pub fn new( code: ExtendedErrorCode, text: Option<Str<Octs>>, ) -> Result<Self, LongOptData>
where Octs: AsRef<[u8]>,

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.

source

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.

source

pub fn code(&self) -> ExtendedErrorCode

Returns the error code.

source

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(_)).

source

pub fn text_slice(&self) -> Option<&[u8]>
where Octs: AsRef<[u8]>,

Returns the text as an octets slice.

source

pub fn set_text(&mut self, text: Str<Octs>)

Sets the text field.

source

pub fn is_private(&self) -> bool

Returns true if the code is in the private range.

source

pub fn parse<'a, Src: Octets<Range<'a> = Octs> + ?Sized>( parser: &mut Parser<'a, Src>, ) -> Result<Self, ParseError>
where Octs: AsRef<[u8]>,

Trait Implementations§

source§

impl<Octs: Clone> Clone for ExtendedError<Octs>

source§

fn clone(&self) -> ExtendedError<Octs>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<Octs: AsRef<[u8]>> ComposeOptData for ExtendedError<Octs>

source§

fn compose_len(&self) -> u16

source§

fn compose_option<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

source§

impl<Octs: AsRef<[u8]>> Debug for ExtendedError<Octs>

source§

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

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

impl<Octs: AsRef<[u8]>> Display for ExtendedError<Octs>

source§

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

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

impl<Octs, Name> From<ExtendedError<Octs>> for AllOptData<Octs, Name>

source§

fn from(value: ExtendedError<Octs>) -> Self

Converts to this type from the input type.
source§

impl<Octs> From<ExtendedErrorCode> for ExtendedError<Octs>

source§

fn from(code: ExtendedErrorCode) -> Self

Converts to this type from the input type.
source§

impl<Octs> From<u16> for ExtendedError<Octs>

source§

fn from(code: u16) -> Self

Converts to this type from the input type.
source§

impl<Octs: AsRef<[u8]>> Hash for ExtendedError<Octs>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<Octs> OptData for ExtendedError<Octs>

source§

fn code(&self) -> OptionCode

Returns the option code associated with this option.
source§

impl<'a, Octs> ParseOptData<'a, Octs> for ExtendedError<Octs::Range<'a>>
where Octs: Octets + ?Sized,

source§

fn parse_option( code: OptionCode, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>

Parses the option code data. Read more
source§

impl<Octs, Other> PartialEq<ExtendedError<Other>> for ExtendedError<Octs>
where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,

source§

fn eq(&self, other: &ExtendedError<Other>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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<Octs> TryFrom<(ExtendedErrorCode, Str<Octs>)> for ExtendedError<Octs>
where Octs: AsRef<[u8]>,

§

type Error = LongOptData

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

fn try_from( (code, text): (ExtendedErrorCode, Str<Octs>), ) -> Result<Self, Self::Error>

Performs the conversion.
source§

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> 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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more