pub struct Understood<Variant, Octs: ?Sized> { /* private fields */ }Expand description
Option data for understood DNSSEC algorithms.
This type provides the option data for the three options DAU, DHU, and
N3U which allow a client to specify the cryptographic algorithms it
supports for DNSSEC signatures, DS hashes, and NSEC3 hashes respectively.
Each of them contains a sequence of SecAlg values in wire format.
Which exact option is to be used is specified via the Variant type
argument. Three marker types DauVariant, DhuVariant and N3uVariant
are defined with accompanying type aliases Dau, Dhu, and N3u.
You can create a new value from anything that can be turned into an
iterator over SecAlg via the
from_sec_algs associated function.
Once you have a value, you can iterate over the algorithms via the
iter method or use the IntoIterator implementation
for a reference.
Implementations§
source§impl<Variant, Octs> Understood<Variant, Octs>
impl<Variant, Octs> Understood<Variant, Octs>
sourcepub fn from_octets(octets: Octs) -> Result<Self, ParseError>where
Octs: AsRef<[u8]>,
pub fn from_octets(octets: Octs) -> Result<Self, ParseError>where Octs: AsRef<[u8]>,
Creates a new value from an octets sequence.
Returns an error if the slice does not contain a value in wire format or is longer than 65,535 octets.
sourcepub unsafe fn from_octets_unchecked(octets: Octs) -> Self
pub unsafe fn from_octets_unchecked(octets: Octs) -> Self
Creates a new value from an octets sequence without checking.
Safety
The caller needs to make sure that the slice contains a sequence of 16 bit values that is no longer than 65,535 octets.
sourcepub fn from_sec_algs(
sec_algs: impl IntoIterator<Item = SecAlg>
) -> Result<Self, BuildDataError>where
Octs: FromBuilder,
<Octs as FromBuilder>::Builder: EmptyBuilder,
pub fn from_sec_algs( sec_algs: impl IntoIterator<Item = SecAlg> ) -> Result<Self, BuildDataError>where Octs: FromBuilder, <Octs as FromBuilder>::Builder: EmptyBuilder,
Creates a new value from a sequence of algorithms.
The operation will fail if the iterator returns more than 32,767 algorithms.
source§impl<Variant> Understood<Variant, [u8]>
impl<Variant> Understood<Variant, [u8]>
sourcepub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>
pub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>
Creates a new value from an octets slice.
Returns an error if the slice does not contain a value in wire format or is longer than 65,535 octets.
sourcepub unsafe fn from_slice_unchecked(slice: &[u8]) -> &Self
pub unsafe fn from_slice_unchecked(slice: &[u8]) -> &Self
Creates a new value from an octets slice without checking.
Safety
The caller needs to make sure that the slice contains a sequence of 16 bit values that is no longer than 65,535 octets.
source§impl<Variant, Octs: AsRef<[u8]>> Understood<Variant, Octs>
impl<Variant, Octs: AsRef<[u8]>> Understood<Variant, Octs>
source§impl<Variant, Octs: ?Sized> Understood<Variant, Octs>
impl<Variant, Octs: ?Sized> Understood<Variant, Octs>
sourcepub fn into_octets(self) -> Octswhere
Octs: Sized,
pub fn into_octets(self) -> Octswhere Octs: Sized,
Converts a value into its underlying octets.
Trait Implementations§
source§impl<Variant, Octs> AsRef<[u8]> for Understood<Variant, Octs>where
Octs: AsRef<[u8]> + ?Sized,
impl<Variant, Octs> AsRef<[u8]> for Understood<Variant, Octs>where Octs: AsRef<[u8]> + ?Sized,
source§impl<Variant, Octs> Borrow<[u8]> for Understood<Variant, Octs>where
Octs: AsRef<[u8]> + ?Sized,
impl<Variant, Octs> Borrow<[u8]> for Understood<Variant, Octs>where Octs: AsRef<[u8]> + ?Sized,
source§impl<Variant: Clone, Octs: Clone + ?Sized> Clone for Understood<Variant, Octs>
impl<Variant: Clone, Octs: Clone + ?Sized> Clone for Understood<Variant, Octs>
source§fn clone(&self) -> Understood<Variant, Octs>
fn clone(&self) -> Understood<Variant, Octs>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<Variant, Octs> ComposeOptData for Understood<Variant, Octs>where
Self: OptData,
Octs: AsRef<[u8]> + ?Sized,
impl<Variant, Octs> ComposeOptData for Understood<Variant, Octs>where Self: OptData, Octs: AsRef<[u8]> + ?Sized,
fn compose_len(&self) -> u16
fn compose_option<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target ) -> Result<(), Target::AppendError>
source§impl<Octs, Name> From<Understood<DauVariant, Octs>> for AllOptData<Octs, Name>
impl<Octs, Name> From<Understood<DauVariant, Octs>> for AllOptData<Octs, Name>
source§impl<Octs, Name> From<Understood<DhuVariant, Octs>> for AllOptData<Octs, Name>
impl<Octs, Name> From<Understood<DhuVariant, Octs>> for AllOptData<Octs, Name>
source§impl<Octs, Name> From<Understood<N3uVariant, Octs>> for AllOptData<Octs, Name>
impl<Octs, Name> From<Understood<N3uVariant, Octs>> for AllOptData<Octs, Name>
source§impl<'a, Variant, Octs> IntoIterator for &'a Understood<Variant, Octs>where
Octs: AsRef<[u8]> + ?Sized,
impl<'a, Variant, Octs> IntoIterator for &'a Understood<Variant, Octs>where Octs: AsRef<[u8]> + ?Sized,
source§impl<Variant, O, OO> OctetsFrom<Understood<Variant, O>> for Understood<Variant, OO>where
OO: OctetsFrom<O>,
impl<Variant, O, OO> OctetsFrom<Understood<Variant, O>> for Understood<Variant, OO>where OO: OctetsFrom<O>,
type Error = <OO as OctetsFrom<O>>::Error
source§fn try_octets_from(source: Understood<Variant, O>) -> Result<Self, Self::Error>
fn try_octets_from(source: Understood<Variant, O>) -> Result<Self, Self::Error>
source§impl<Octs: ?Sized> OptData for Understood<DauVariant, Octs>
impl<Octs: ?Sized> OptData for Understood<DauVariant, Octs>
source§fn code(&self) -> OptionCode
fn code(&self) -> OptionCode
source§impl<Octs: ?Sized> OptData for Understood<DhuVariant, Octs>
impl<Octs: ?Sized> OptData for Understood<DhuVariant, Octs>
source§fn code(&self) -> OptionCode
fn code(&self) -> OptionCode
source§impl<Octs: ?Sized> OptData for Understood<N3uVariant, Octs>
impl<Octs: ?Sized> OptData for Understood<N3uVariant, Octs>
source§fn code(&self) -> OptionCode
fn code(&self) -> OptionCode
source§impl<'a, Octs: Octets + ?Sized> ParseOptData<'a, Octs> for Understood<DauVariant, Octs::Range<'a>>
impl<'a, Octs: Octets + ?Sized> ParseOptData<'a, Octs> for Understood<DauVariant, Octs::Range<'a>>
source§fn parse_option(
code: OptionCode,
parser: &mut Parser<'a, Octs>
) -> Result<Option<Self>, ParseError>
fn parse_option( code: OptionCode, parser: &mut Parser<'a, Octs> ) -> Result<Option<Self>, ParseError>
source§impl<'a, Octs: Octets + ?Sized> ParseOptData<'a, Octs> for Understood<DhuVariant, Octs::Range<'a>>
impl<'a, Octs: Octets + ?Sized> ParseOptData<'a, Octs> for Understood<DhuVariant, Octs::Range<'a>>
source§fn parse_option(
code: OptionCode,
parser: &mut Parser<'a, Octs>
) -> Result<Option<Self>, ParseError>
fn parse_option( code: OptionCode, parser: &mut Parser<'a, Octs> ) -> Result<Option<Self>, ParseError>
source§impl<'a, Octs: Octets + ?Sized> ParseOptData<'a, Octs> for Understood<N3uVariant, Octs::Range<'a>>
impl<'a, Octs: Octets + ?Sized> ParseOptData<'a, Octs> for Understood<N3uVariant, Octs::Range<'a>>
source§fn parse_option(
code: OptionCode,
parser: &mut Parser<'a, Octs>
) -> Result<Option<Self>, ParseError>
fn parse_option( code: OptionCode, parser: &mut Parser<'a, Octs> ) -> Result<Option<Self>, ParseError>
source§impl<Var, OtherVar, Octs, OtherOcts> PartialEq<Understood<OtherVar, OtherOcts>> for Understood<Var, Octs>where
Octs: AsRef<[u8]> + ?Sized,
OtherOcts: AsRef<[u8]> + ?Sized,
impl<Var, OtherVar, Octs, OtherOcts> PartialEq<Understood<OtherVar, OtherOcts>> for Understood<Var, Octs>where Octs: AsRef<[u8]> + ?Sized, OtherOcts: AsRef<[u8]> + ?Sized,
source§fn eq(&self, other: &Understood<OtherVar, OtherOcts>) -> bool
fn eq(&self, other: &Understood<OtherVar, OtherOcts>) -> bool
self and other values to be equal, and is used
by ==.