Struct domain::base::opt::Opt

source ·
pub struct Opt<Octs: ?Sized> { /* private fields */ }
Expand description

OPT record data.

This is the record data type for OPT records and can be used as the data type parameter in Record. It simply wraps an octets sequence with all the record data. It guarantees that the data contains a correctly formatted sequence of options but doesn’t guarantee that the options themselves are correct. You can iterate over options via the iter method.

Since some of the information of the OPT record is transmitted in the record header, a special type OptRecord exists, that contains all the OPT data which is the preferred way of accessing this data.

Implementations§

source§

impl<Octs: Octets> Opt<Octs>

source

pub fn dau(&self) -> Option<Dau<Octs::Range<'_>>>

Returns the first DAU option if present.

This option lists the DNSSEC signature algorithms the requester supports.

source

pub fn dhu(&self) -> Option<Dhu<Octs::Range<'_>>>

Returns the first DHU option if present.

This option lists the DS hash algorithms the requester supports.

source

pub fn n3u(&self) -> Option<N3u<Octs::Range<'_>>>

Returns the first N3U option if present.

This option lists the NSEC3 hash algorithms the requester supports.

source§

impl<Octs: Octets> Opt<Octs>

source

pub fn chain(&self) -> Option<Chain<Dname<Octs::Range<'_>>>>

Returns the first CHAIN option if present.

The CHAIN option allows a client to request that all records that are necessary for DNSSEC validation are included in the response.

source§

impl<Octs: Octets> Opt<Octs>

source

pub fn cookie(&self) -> Option<Cookie>

Returns the first cookie option if present.

source§

impl<Octs: Octets> Opt<Octs>

source

pub fn expire(&self) -> Option<Expire>

Returns the content of the Expire option if present.

The Expire option allows an authoritative server to signal its own expiry time of a zone.

source§

impl<Octs: Octets> Opt<Octs>

source

pub fn extended_error(&self) -> Option<ExtendedError<Octs::Range<'_>>>

Returns the first extended DNS error option if present.

The extended DNS error option carries additional error information in a failed answer.

source§

impl<Octs: Octets> Opt<Octs>

source

pub fn tcp_keepalive(&self) -> Option<TcpKeepalive>

Returns the first edns-tcp-keepalive option if present.

This option is used to signal a timeout to keep a TCP connection open.

source§

impl<Octs: Octets> Opt<Octs>

source

pub fn key_tag(&self) -> Option<KeyTag<Octs::Range<'_>>>

Returns the first edns-key-tags option if present.

The option contains a list of the key tags of the trust anchor keys a validating resolver is using for DNSSEC validation.

source§

impl<Octs: Octets> Opt<Octs>

source

pub fn nsid(&self) -> Option<Nsid<Octs::Range<'_>>>

Returns the first NSID option present.

In a response, the NSID option contains an identifier of the name server that answered the query. In a query, the option is empty and signals a request for inclusion in a response.

source§

impl<Octs: Octets> Opt<Octs>

source

pub fn client_subnet(&self) -> Option<ClientSubnet>

Returns the first client subnet option if present.

This option allows a resolver to include information about the network a query originated from. This information can then be used by an authoritative server to provide the best response for this network.

source§

impl<Octs: AsRef<[u8]>> Opt<Octs>

source

pub fn from_octets(octets: Octs) -> Result<Self, ParseError>

Creates OPT record data from an octets sequence.

The function checks whether the octets contain a sequence of options. It does not check whether the options themselves are valid.

source

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

Parses OPT record data from the beginning of a parser.

source§

impl Opt<[u8]>

source

pub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>

Creates OPT record data from an octets slice.

source§

impl<Octs: AsRef<[u8]> + ?Sized> Opt<Octs>

source

pub fn len(&self) -> usize

Returns the length of the OPT record data.

source

pub fn is_empty(&self) -> bool

Returns whether the OPT record data is empty.

source

pub fn iter<'s, Data>(&'s self) -> OptIter<'s, Octs, Data>
where Octs: Octets, Data: ParseOptData<'s, Octs>,

Returns an iterator over options of a given type.

The returned iterator will return only options represented by type D and quietly skip over all the others.

source

pub fn first<'s, Data>(&'s self) -> Option<Data>
where Octs: Octets, Data: ParseOptData<'s, Octs>,

Returns the first option of a given type if present.

If trying to parse this first option fails, returns None as well.

Trait Implementations§

source§

impl<Octs> AsRef<Opt<Octs>> for OptRecord<Octs>

source§

fn as_ref(&self) -> &Opt<Octs>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<Octs: Clone + ?Sized> Clone for Opt<Octs>

source§

fn clone(&self) -> Opt<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]> + ?Sized> ComposeRecordData for Opt<Octs>

source§

fn rdlen(&self, _compress: bool) -> Option<u16>

Returns the length of the record data if available. Read more
source§

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

Appends the wire format of the record data into target.
source§

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

Appends the canonical wire format of the record data into target.
source§

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

Appends the record data prefixed with its length.
source§

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

Appends the record data prefixed with its length.
source§

impl<Octs: AsRef<[u8]> + ?Sized> Debug for Opt<Octs>

source§

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

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

impl<Octs: AsRef<[u8]> + ?Sized> Display for Opt<Octs>

source§

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

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

impl<O, N> From<Opt<O>> for AllRecordData<O, N>

source§

fn from(value: Opt<O>) -> Self

Converts to this type from the input type.
source§

impl<Octs: AsRef<[u8]> + ?Sized> Hash for Opt<Octs>

source§

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

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

impl<Octs, SrcOcts> OctetsFrom<Opt<SrcOcts>> for Opt<Octs>
where Octs: OctetsFrom<SrcOcts>,

§

type Error = <Octs as OctetsFrom<SrcOcts>>::Error

source§

fn try_octets_from(source: Opt<SrcOcts>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<Octs: AsRef<[u8]> + ?Sized> Ord for Opt<Octs>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl<'a, Octs> ParseRecordData<'a, Octs> for Opt<Octs::Range<'a>>
where Octs: Octets + ?Sized,

source§

fn parse_rdata( rtype: Rtype, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>

Parses the record data. Read more
source§

impl<Octs, Other> PartialEq<Opt<Other>> for Opt<Octs>
where Octs: AsRef<[u8]> + ?Sized, Other: AsRef<[u8]> + ?Sized,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Octs, Other> PartialOrd<Opt<Other>> for Opt<Octs>
where Octs: AsRef<[u8]> + ?Sized, Other: AsRef<[u8]> + ?Sized,

source§

fn partial_cmp(&self, other: &Opt<Other>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<Octs: ?Sized> RecordData for Opt<Octs>

source§

fn rtype(&self) -> Rtype

Returns the record type associated with this record data instance. Read more
source§

impl<Octs: AsRef<[u8]> + ?Sized> Eq for Opt<Octs>

Auto Trait Implementations§

§

impl<Octs> Freeze for Opt<Octs>
where Octs: Freeze + ?Sized,

§

impl<Octs> RefUnwindSafe for Opt<Octs>
where Octs: RefUnwindSafe + ?Sized,

§

impl<Octs> Send for Opt<Octs>
where Octs: Send + ?Sized,

§

impl<Octs> Sync for Opt<Octs>
where Octs: Sync + ?Sized,

§

impl<Octs> Unpin for Opt<Octs>
where Octs: Unpin + ?Sized,

§

impl<Octs> UnwindSafe for Opt<Octs>
where Octs: UnwindSafe + ?Sized,

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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