pub struct OptRecord<'a>(/* private fields */);Expand description
Typed view of an OPT (EDNS0) record.
OPT records repurpose the class and TTL fields for EDNS metadata; the
generic DnsRr::dns_class and DnsRr::ttl still return those raw
values, but the typed accessors below interpret them per RFC 6891.
Implementations§
Source§impl<'a> OptRecord<'a>
impl<'a> OptRecord<'a>
Sourcepub fn udp_size(self) -> u16
pub fn udp_size(self) -> u16
Sender’s UDP payload size
(OPT_UDP_SIZE).
Sourcepub fn version(self) -> u8
pub fn version(self) -> u8
EDNS version (OPT_VERSION).
Sourcepub fn option_count(self) -> usize
pub fn option_count(self) -> usize
Returns the number of EDNS options
(OPT_OPTIONS).
Sourcepub fn options(
self,
) -> impl Iterator<Item = (u16, Result<OptValue, OptParseError>)> + 'a
pub fn options( self, ) -> impl Iterator<Item = (u16, Result<OptValue, OptParseError>)> + 'a
Returns an iterator over EDNS options
(OPT_OPTIONS) yielding
(option_code, decoded_value) pairs.
The value is decoded according to its registered datatype (see
OptValue). For options the linked c-ares does not recognise,
decoding may fail; use raw_options to
access the underlying byte slice instead.
Sourcepub fn raw_options(self) -> impl Iterator<Item = (u16, &'a [u8])>
pub fn raw_options(self) -> impl Iterator<Item = (u16, &'a [u8])>
Returns an iterator over EDNS options
(OPT_OPTIONS) yielding
(option_code, value_bytes) pairs without decoding.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for OptRecord<'a>
impl<'a> RefUnwindSafe for OptRecord<'a>
impl<'a> Send for OptRecord<'a>
impl<'a> Sync for OptRecord<'a>
impl<'a> Unpin for OptRecord<'a>
impl<'a> UnsafeUnpin for OptRecord<'a>
impl<'a> UnwindSafe for OptRecord<'a>
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more