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>
impl<Octs: Octets> Opt<Octs>
sourcepub fn dau(&self) -> Option<Dau<Octs::Range<'_>>>
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§impl<Octs: Octets> Opt<Octs>
impl<Octs: Octets> Opt<Octs>
sourcepub fn extended_error(&self) -> Option<ExtendedError<Octs::Range<'_>>>
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>
impl<Octs: Octets> Opt<Octs>
sourcepub fn tcp_keepalive(&self) -> Option<TcpKeepalive>
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>
impl<Octs: Octets> Opt<Octs>
sourcepub fn client_subnet(&self) -> Option<ClientSubnet>
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>
impl<Octs: AsRef<[u8]>> Opt<Octs>
sourcepub fn from_octets(octets: Octs) -> Result<Self, ParseError>
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§impl Opt<[u8]>
impl Opt<[u8]>
sourcepub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>
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>
impl<Octs: AsRef<[u8]> + ?Sized> Opt<Octs>
sourcepub fn iter<'s, Data>(&'s self) -> OptIter<'s, Octs, Data> ⓘwhere
Octs: Octets,
Data: ParseOptData<'s, Octs>,
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.
sourcepub fn first<'s, Data>(&'s self) -> Option<Data>where
Octs: Octets,
Data: ParseOptData<'s, Octs>,
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.
source§impl<Octs: Composer> Opt<Octs>
impl<Octs: Composer> Opt<Octs>
sourcepub fn push<Opt: ComposeOptData + ?Sized>(
&mut self,
option: &Opt,
) -> Result<(), BuildDataError>
pub fn push<Opt: ComposeOptData + ?Sized>( &mut self, option: &Opt, ) -> Result<(), BuildDataError>
Appends a new option to the OPT data.
sourcepub fn push_raw_option<F>(
&mut self,
code: OptionCode,
option_len: u16,
op: F,
) -> Result<(), BuildDataError>
pub fn push_raw_option<F>( &mut self, code: OptionCode, option_len: u16, op: F, ) -> Result<(), BuildDataError>
Appends a raw option to the OPT data.
The method will append an option with the given option code. The data
of the option will be written via the closure op
.
Trait Implementations§
source§impl<Octs, Other> CanonicalOrd<Opt<Other>> for Opt<Octs>
impl<Octs, Other> CanonicalOrd<Opt<Other>> for Opt<Octs>
source§fn canonical_cmp(&self, other: &Opt<Other>) -> Ordering
fn canonical_cmp(&self, other: &Opt<Other>) -> Ordering
self
and other
.source§fn canonical_lt(&self, other: &Rhs) -> bool
fn canonical_lt(&self, other: &Rhs) -> bool
self
is canonically less than other
.source§fn canonical_le(&self, other: &Rhs) -> bool
fn canonical_le(&self, other: &Rhs) -> bool
self
is canonically less than or equal to other
.source§fn canonical_gt(&self, other: &Rhs) -> bool
fn canonical_gt(&self, other: &Rhs) -> bool
self
is canonically greater than other
.source§fn canonical_ge(&self, other: &Rhs) -> bool
fn canonical_ge(&self, other: &Rhs) -> bool
self
is canonically greater than or equal to other
.source§impl<Octs: AsRef<[u8]> + ?Sized> ComposeRecordData for Opt<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> ComposeRecordData for Opt<Octs>
source§fn rdlen(&self, _compress: bool) -> Option<u16>
fn rdlen(&self, _compress: bool) -> Option<u16>
source§fn compose_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
target
.source§fn compose_canonical_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_canonical_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
target
.source§fn compose_len_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_len_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
source§fn compose_canonical_len_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_canonical_len_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
source§impl<O, N> From<Opt<O>> for AllRecordData<O, N>
impl<O, N> From<Opt<O>> for AllRecordData<O, N>
source§impl<Octs, SrcOcts> OctetsFrom<Opt<SrcOcts>> for Opt<Octs>where
Octs: OctetsFrom<SrcOcts>,
impl<Octs, SrcOcts> OctetsFrom<Opt<SrcOcts>> for Opt<Octs>where
Octs: OctetsFrom<SrcOcts>,
source§impl<'a, Octs> ParseRecordData<'a, Octs> for Opt<Octs::Range<'a>>
impl<'a, Octs> ParseRecordData<'a, Octs> for Opt<Octs::Range<'a>>
source§fn parse_rdata(
rtype: Rtype,
parser: &mut Parser<'a, Octs>,
) -> Result<Option<Self>, ParseError>
fn parse_rdata( rtype: Rtype, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>
source§impl<Octs, Other> PartialOrd<Opt<Other>> for Opt<Octs>
impl<Octs, Other> PartialOrd<Opt<Other>> for Opt<Octs>
source§impl<Octs: ?Sized> RecordData for Opt<Octs>
impl<Octs: ?Sized> RecordData for Opt<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> Eq for Opt<Octs>
Auto Trait Implementations§
impl<Octs> Freeze for Opt<Octs>
impl<Octs> RefUnwindSafe for Opt<Octs>where
Octs: RefUnwindSafe + ?Sized,
impl<Octs> Send for Opt<Octs>
impl<Octs> Sync for Opt<Octs>
impl<Octs> Unpin for Opt<Octs>
impl<Octs> UnwindSafe for Opt<Octs>where
Octs: UnwindSafe + ?Sized,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)