pub struct OptRecord<Octets> { /* private fields */ }
Expand description
An entire OPT record.
Because the EDNS specificiation uses parts of the header of the OPT record
to convey some information, a special record type is necessary for OPT
records. You can convert a normal record with Opt
record data into
an OptRecord
via the from_record
function.
The type derefs to the Opt
type and provides all its functionality
that way.
Implementations
sourceimpl<Octets> OptRecord<Octets>
impl<Octets> OptRecord<Octets>
sourcepub fn from_record<N: ToDname>(record: Record<N, Opt<Octets>>) -> Self
pub fn from_record<N: ToDname>(record: Record<N, Opt<Octets>>) -> Self
Converts a regular record into an OPT record
sourcepub fn udp_payload_size(&self) -> u16
pub fn udp_payload_size(&self) -> u16
Returns the UDP payload size.
Through this field a sender of a message can signal the maximum size of UDP payload the sender is able to handle when receiving messages. This value refers to the abilities of the sender’s DNS implementation, not such things as network MTUs. Which means that the largest UDP payload that can actually be sent back to the sender may be smaller.
sourcepub fn rcode(&self, header: Header) -> OptRcode
pub fn rcode(&self, header: Header) -> OptRcode
Returns the extended rcode.
Some of the bits of the rcode are stored in the regular message header. Such a header needs to be passed to the method.
sourcepub fn version(&self) -> u8
pub fn version(&self) -> u8
Returns the EDNS version of the OPT header.
Only EDNS version 0 is currently defined.
Methods from Deref<Target = Opt<Octets>>
sourcepub fn iter<Data>(&self) -> OptIter<&Octets, Data>ⓘNotable traits for OptIter<Ref, Data>impl<Ref, Data> Iterator for OptIter<Ref, Data>where
Ref: OctetsRef,
Data: ParseOptData<Ref>, type Item = Result<Data, ParseError>;
where
for<'a> &'a Octets: OctetsRef,
Data: for<'a> ParseOptData<&'a Octets>,
pub fn iter<Data>(&self) -> OptIter<&Octets, Data>ⓘNotable traits for OptIter<Ref, Data>impl<Ref, Data> Iterator for OptIter<Ref, Data>where
Ref: OctetsRef,
Data: ParseOptData<Ref>, type Item = Result<Data, ParseError>;
where
for<'a> &'a Octets: OctetsRef,
Data: for<'a> ParseOptData<&'a Octets>,
Ref: OctetsRef,
Data: ParseOptData<Ref>, type Item = Result<Data, ParseError>;
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.
Trait Implementations
sourceimpl<Octets, SrcOctets> OctetsFrom<OptRecord<SrcOctets>> for OptRecord<Octets>where
Octets: OctetsFrom<SrcOctets>,
impl<Octets, SrcOctets> OctetsFrom<OptRecord<SrcOctets>> for OptRecord<Octets>where
Octets: OctetsFrom<SrcOctets>,
sourcefn octets_from(source: OptRecord<SrcOctets>) -> Result<Self, ShortBuf>
fn octets_from(source: OptRecord<SrcOctets>) -> Result<Self, ShortBuf>
Performs the conversion.
Auto Trait Implementations
impl<Octets> RefUnwindSafe for OptRecord<Octets>where
Octets: RefUnwindSafe,
impl<Octets> Send for OptRecord<Octets>where
Octets: Send,
impl<Octets> Sync for OptRecord<Octets>where
Octets: Sync,
impl<Octets> Unpin for OptRecord<Octets>where
Octets: Unpin,
impl<Octets> UnwindSafe for OptRecord<Octets>where
Octets: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
sourcefn octets_into(self) -> Result<Target, ShortBuf>
fn octets_into(self) -> Result<Target, ShortBuf>
Performs the conversion.