Struct domain::base::opt::algsig::Understood

source ·
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>

source

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.

source

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.

source

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]>

source

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.

source

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>

source

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

Parses a value from its wire format.

source§

impl<Variant, Octs: ?Sized> Understood<Variant, Octs>

source

pub fn as_octets(&self) -> &Octs

Returns a reference to the underlying octets.

source

pub fn into_octets(self) -> Octs
where Octs: Sized,

Converts a value into its underlying octets.

source

pub fn as_slice(&self) -> &[u8]
where Octs: AsRef<[u8]>,

Returns the data as an octets slice.

source

pub fn for_slice(&self) -> &Understood<Variant, [u8]>
where Octs: AsRef<[u8]>,

Returns a reference to a value over an octets slice.

source

pub fn iter(&self) -> SecAlgsIter<'_>
where Octs: AsRef<[u8]>,

Returns an iterator over the algorithms in the data.

Trait Implementations§

source§

impl<Variant, Octs> AsRef<[u8]> for Understood<Variant, Octs>
where Octs: AsRef<[u8]> + ?Sized,

source§

fn as_ref(&self) -> &[u8]

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

impl<Variant, Octs> Borrow<[u8]> for Understood<Variant, Octs>
where Octs: AsRef<[u8]> + ?Sized,

source§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
source§

impl<Variant: Clone, Octs: Clone + ?Sized> Clone for Understood<Variant, Octs>

source§

fn clone(&self) -> Understood<Variant, 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<Variant, Octs> ComposeOptData for Understood<Variant, Octs>
where Self: OptData, Octs: AsRef<[u8]> + ?Sized,

source§

fn compose_len(&self) -> u16

source§

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

source§

impl<Variant: Debug, Octs: Debug + ?Sized> Debug for Understood<Variant, Octs>

source§

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

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

impl<Variant, Octs> Display for Understood<Variant, Octs>
where Octs: AsRef<[u8]> + ?Sized,

source§

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

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

impl<Octs, Name> From<Understood<DauVariant, Octs>> for AllOptData<Octs, Name>

source§

fn from(value: Dau<Octs>) -> Self

Converts to this type from the input type.
source§

impl<Octs, Name> From<Understood<DhuVariant, Octs>> for AllOptData<Octs, Name>

source§

fn from(value: Dhu<Octs>) -> Self

Converts to this type from the input type.
source§

impl<Octs, Name> From<Understood<N3uVariant, Octs>> for AllOptData<Octs, Name>

source§

fn from(value: N3u<Octs>) -> Self

Converts to this type from the input type.
source§

impl<Variant, Octs: AsRef<[u8]>> Hash for Understood<Variant, Octs>

source§

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

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

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a, Variant, Octs> IntoIterator for &'a Understood<Variant, Octs>
where Octs: AsRef<[u8]> + ?Sized,

§

type Item = SecAlg

The type of the elements being iterated over.
§

type IntoIter = SecAlgsIter<'a>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

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>

Performs the conversion.
source§

impl<Octs: ?Sized> OptData for Understood<DauVariant, Octs>

source§

fn code(&self) -> OptionCode

Returns the option code associated with this option.
source§

impl<Octs: ?Sized> OptData for Understood<DhuVariant, Octs>

source§

fn code(&self) -> OptionCode

Returns the option code associated with this option.
source§

impl<Octs: ?Sized> OptData for Understood<N3uVariant, Octs>

source§

fn code(&self) -> OptionCode

Returns the option code associated with this option.
source§

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>

Parses the option code data. Read more
source§

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>

Parses the option code data. Read more
source§

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>

Parses the option code data. Read more
source§

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

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<Variant: Copy, Octs: Copy + ?Sized> Copy for Understood<Variant, Octs>

source§

impl<Variant, Octs: AsRef<[u8]> + ?Sized> Eq for Understood<Variant, Octs>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

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