#[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
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>
impl<'a> Rdata<'a>
Sourcepub const fn is_a(&self) -> bool
pub const fn is_a(&self) -> bool
Returns true if this value is of type A. Returns false otherwise
Sourcepub const fn is_aaaa(&self) -> bool
pub const fn is_aaaa(&self) -> bool
Returns true if this value is of type AAAA. Returns false otherwise
Sourcepub const fn is_ptr(&self) -> bool
pub const fn is_ptr(&self) -> bool
Returns true if this value is of type Ptr. Returns false otherwise
Sourcepub const fn is_cname(&self) -> bool
pub const fn is_cname(&self) -> bool
Returns true if this value is of type Cname. Returns false otherwise
Sourcepub const fn is_srv(&self) -> bool
pub const fn is_srv(&self) -> bool
Returns true if this value is of type Srv. Returns false otherwise
Sourcepub const fn is_txt(&self) -> bool
pub const fn is_txt(&self) -> bool
Returns true if this value is of type Txt. Returns false otherwise
Source§impl<'a> Rdata<'a>
impl<'a> Rdata<'a>
Sourcepub fn unwrap_a(self) -> A
pub fn unwrap_a(self) -> A
Unwraps this value to the Rdata::A variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_a_ref(&self) -> &A
pub fn unwrap_a_ref(&self) -> &A
Unwraps this reference to the Rdata::A variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_aaaa(self) -> AAAA
pub fn unwrap_aaaa(self) -> AAAA
Unwraps this value to the Rdata::AAAA variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_aaaa_ref(&self) -> &AAAA
pub fn unwrap_aaaa_ref(&self) -> &AAAA
Unwraps this reference to the Rdata::AAAA variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_ptr(self) -> Ptr<'a>
pub fn unwrap_ptr(self) -> Ptr<'a>
Unwraps this value to the Rdata::Ptr variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_ptr_ref(&self) -> &Ptr<'a>
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.
Sourcepub fn unwrap_cname(self) -> Cname<'a>
pub fn unwrap_cname(self) -> Cname<'a>
Unwraps this value to the Rdata::Cname variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_cname_ref(&self) -> &Cname<'a>
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.
Sourcepub fn unwrap_srv(self) -> Srv<'a>
pub fn unwrap_srv(self) -> Srv<'a>
Unwraps this value to the Rdata::Srv variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_srv_ref(&self) -> &Srv<'a>
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.
Sourcepub fn unwrap_txt(self) -> Txt<'a>
pub fn unwrap_txt(self) -> Txt<'a>
Unwraps this value to the Rdata::Txt variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_txt_ref(&self) -> &Txt<'a>
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.
Sourcepub fn unwrap_nsec(self) -> Nsec<'a>
pub fn unwrap_nsec(self) -> Nsec<'a>
Unwraps this value to the Rdata::Nsec variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_nsec_ref(&self) -> &Nsec<'a>
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.
Sourcepub fn unwrap_other(self) -> &'a [u8] ⓘ
pub fn unwrap_other(self) -> &'a [u8] ⓘ
Unwraps this value to the Rdata::Other variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_other_ref(&self) -> &&'a [u8] ⓘ
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>
impl<'a> Rdata<'a>
Sourcepub fn try_unwrap_a(self) -> Result<A, TryUnwrapError<Self>>
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.
Sourcepub fn try_unwrap_a_ref(&self) -> Result<&A, TryUnwrapError<&Self>>
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.
Sourcepub fn try_unwrap_aaaa(self) -> Result<AAAA, TryUnwrapError<Self>>
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.
Sourcepub fn try_unwrap_aaaa_ref(&self) -> Result<&AAAA, TryUnwrapError<&Self>>
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.
Sourcepub fn try_unwrap_ptr(self) -> Result<Ptr<'a>, TryUnwrapError<Self>>
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.
Sourcepub fn try_unwrap_ptr_ref(&self) -> Result<&Ptr<'a>, TryUnwrapError<&Self>>
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.
Sourcepub fn try_unwrap_cname(self) -> Result<Cname<'a>, TryUnwrapError<Self>>
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.
Sourcepub fn try_unwrap_cname_ref(&self) -> Result<&Cname<'a>, TryUnwrapError<&Self>>
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.
Sourcepub fn try_unwrap_srv(self) -> Result<Srv<'a>, TryUnwrapError<Self>>
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.
Sourcepub fn try_unwrap_srv_ref(&self) -> Result<&Srv<'a>, TryUnwrapError<&Self>>
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.
Sourcepub fn try_unwrap_txt(self) -> Result<Txt<'a>, TryUnwrapError<Self>>
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.
Sourcepub fn try_unwrap_txt_ref(&self) -> Result<&Txt<'a>, TryUnwrapError<&Self>>
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.
Sourcepub fn try_unwrap_nsec(self) -> Result<Nsec<'a>, TryUnwrapError<Self>>
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.
Sourcepub fn try_unwrap_nsec_ref(&self) -> Result<&Nsec<'a>, TryUnwrapError<&Self>>
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.
Sourcepub fn try_unwrap_other(self) -> Result<&'a [u8], TryUnwrapError<Self>>
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.
Sourcepub fn try_unwrap_other_ref(&self) -> Result<&&'a [u8], TryUnwrapError<&Self>>
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.