Skip to main content

Rdata

Enum Rdata 

Source
#[non_exhaustive]
pub enum Rdata<'a> { A(A), AAAA(AAAA), Ptr(Ptr<'a>), Cname(Cname<'a>), Srv(Srv<'a>), Txt(Txt<'a>), Nsec(Nsec<'a>), Other(&'a [u8]), }
Expand description

Dispatched rdata view — interprets rdata per rtype.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

A(A)

Parsed A record (IPv4 address).

§

AAAA(AAAA)

Parsed AAAA record (IPv6 address).

§

Ptr(Ptr<'a>)

Parsed PTR record (domain name pointer).

§

Cname(Cname<'a>)

Parsed CNAME record (canonical name alias).

§

Srv(Srv<'a>)

Parsed SRV record (server location).

§

Txt(Txt<'a>)

Parsed TXT record (key=value text segments).

§

Nsec(Nsec<'a>)

Parsed NSEC record (negative-answer hint).

§

Other(&'a [u8])

Catch-all for record types this crate does not type-specifically parse (or for Unknown rtypes).

Implementations§

Source§

impl<'a> Rdata<'a>

Source

pub const fn is_a(&self) -> bool

Returns true if this value is of type A. Returns false otherwise

Source

pub const fn is_aaaa(&self) -> bool

Returns true if this value is of type AAAA. Returns false otherwise

Source

pub const fn is_ptr(&self) -> bool

Returns true if this value is of type Ptr. Returns false otherwise

Source

pub const fn is_cname(&self) -> bool

Returns true if this value is of type Cname. Returns false otherwise

Source

pub const fn is_srv(&self) -> bool

Returns true if this value is of type Srv. Returns false otherwise

Source

pub const fn is_txt(&self) -> bool

Returns true if this value is of type Txt. Returns false otherwise

Source

pub const fn is_nsec(&self) -> bool

Returns true if this value is of type Nsec. Returns false otherwise

Source

pub const fn is_other(&self) -> bool

Returns true if this value is of type Other. Returns false otherwise

Source§

impl<'a> Rdata<'a>

Source

pub fn unwrap_a(self) -> A

Unwraps this value to the Rdata::A variant. Panics if this value is of any other type.

Source

pub fn unwrap_a_ref(&self) -> &A

Unwraps this reference to the Rdata::A variant. Panics if this value is of any other type.

Source

pub fn unwrap_aaaa(self) -> AAAA

Unwraps this value to the Rdata::AAAA variant. Panics if this value is of any other type.

Source

pub fn unwrap_aaaa_ref(&self) -> &AAAA

Unwraps this reference to the Rdata::AAAA variant. Panics if this value is of any other type.

Source

pub fn unwrap_ptr(self) -> Ptr<'a>

Unwraps this value to the Rdata::Ptr variant. Panics if this value is of any other type.

Source

pub fn unwrap_ptr_ref(&self) -> &Ptr<'a>

Unwraps this reference to the Rdata::Ptr variant. Panics if this value is of any other type.

Source

pub fn unwrap_cname(self) -> Cname<'a>

Unwraps this value to the Rdata::Cname variant. Panics if this value is of any other type.

Source

pub fn unwrap_cname_ref(&self) -> &Cname<'a>

Unwraps this reference to the Rdata::Cname variant. Panics if this value is of any other type.

Source

pub fn unwrap_srv(self) -> Srv<'a>

Unwraps this value to the Rdata::Srv variant. Panics if this value is of any other type.

Source

pub fn unwrap_srv_ref(&self) -> &Srv<'a>

Unwraps this reference to the Rdata::Srv variant. Panics if this value is of any other type.

Source

pub fn unwrap_txt(self) -> Txt<'a>

Unwraps this value to the Rdata::Txt variant. Panics if this value is of any other type.

Source

pub fn unwrap_txt_ref(&self) -> &Txt<'a>

Unwraps this reference to the Rdata::Txt variant. Panics if this value is of any other type.

Source

pub fn unwrap_nsec(self) -> Nsec<'a>

Unwraps this value to the Rdata::Nsec variant. Panics if this value is of any other type.

Source

pub fn unwrap_nsec_ref(&self) -> &Nsec<'a>

Unwraps this reference to the Rdata::Nsec variant. Panics if this value is of any other type.

Source

pub fn unwrap_other(self) -> &'a [u8]

Unwraps this value to the Rdata::Other variant. Panics if this value is of any other type.

Source

pub fn unwrap_other_ref(&self) -> &&'a [u8]

Unwraps this reference to the Rdata::Other variant. Panics if this value is of any other type.

Source§

impl<'a> Rdata<'a>

Source

pub fn try_unwrap_a(self) -> Result<A, TryUnwrapError<Self>>

Attempts to unwrap this value to the Rdata::A variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_a_ref(&self) -> Result<&A, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Rdata::A variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_aaaa(self) -> Result<AAAA, TryUnwrapError<Self>>

Attempts to unwrap this value to the Rdata::AAAA variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_aaaa_ref(&self) -> Result<&AAAA, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Rdata::AAAA variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_ptr(self) -> Result<Ptr<'a>, TryUnwrapError<Self>>

Attempts to unwrap this value to the Rdata::Ptr variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_ptr_ref(&self) -> Result<&Ptr<'a>, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Rdata::Ptr variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_cname(self) -> Result<Cname<'a>, TryUnwrapError<Self>>

Attempts to unwrap this value to the Rdata::Cname variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_cname_ref(&self) -> Result<&Cname<'a>, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Rdata::Cname variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_srv(self) -> Result<Srv<'a>, TryUnwrapError<Self>>

Attempts to unwrap this value to the Rdata::Srv variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_srv_ref(&self) -> Result<&Srv<'a>, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Rdata::Srv variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_txt(self) -> Result<Txt<'a>, TryUnwrapError<Self>>

Attempts to unwrap this value to the Rdata::Txt variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_txt_ref(&self) -> Result<&Txt<'a>, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Rdata::Txt variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_nsec(self) -> Result<Nsec<'a>, TryUnwrapError<Self>>

Attempts to unwrap this value to the Rdata::Nsec variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_nsec_ref(&self) -> Result<&Nsec<'a>, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Rdata::Nsec variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_other(self) -> Result<&'a [u8], TryUnwrapError<Self>>

Attempts to unwrap this value to the Rdata::Other variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_other_ref(&self) -> Result<&&'a [u8], TryUnwrapError<&Self>>

Attempts to unwrap this reference to the Rdata::Other variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Trait Implementations§

Source§

impl<'a> Clone for Rdata<'a>

Source§

fn clone(&self) -> Rdata<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for Rdata<'a>

Source§

impl<'a> Debug for Rdata<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Rdata<'a>

§

impl<'a> RefUnwindSafe for Rdata<'a>

§

impl<'a> Send for Rdata<'a>

§

impl<'a> Sync for Rdata<'a>

§

impl<'a> Unpin for Rdata<'a>

§

impl<'a> UnsafeUnpin for Rdata<'a>

§

impl<'a> UnwindSafe for Rdata<'a>

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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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