Struct domain::base::opt::keytag::KeyTag

source ·
pub struct KeyTag<Octs: ?Sized> { /* private fields */ }
Expand description

Option data for the edns-key-tag option.

This option allows a client to indicate the key tags of the trust anchor keys they are using to validate responses. The option contains a sequence of key tags.

Implementations§

source§

impl<Octs> KeyTag<Octs>

source

pub fn from_octets(octets: Octs) -> Result<Self, ParseError>
where Octs: AsRef<[u8]>,

Creates a new value from its content in wire format.

The function returns an error if the octets do not encode a valid edns-key-tag option: the length needs to be an even number of octets and no longer than 65,536 octets.

source

pub unsafe fn from_octets_unchecked(octets: Octs) -> Self

Creates a new value from its wire-format content without checking.

§Safety

The caller needs to ensure that octets is a valid key tag. The length needs to be an even number of octets and no longer than 65,536 octets.

source

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

source§

impl KeyTag<[u8]>

source

pub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>

Creates a key tag value from a slice.

Returns an error if slice does not contain a valid key tag.

source

pub unsafe fn from_slice_unchecked(slice: &[u8]) -> &Self

Creates a key tag value from a slice without checking.

§Safety

The caller needs to ensure that slice contains a valid key tag. The length needs to be an even number of octets and no longer than 65,536 octets.

source§

impl<Octs: ?Sized> KeyTag<Octs>

source

pub fn as_octets(&self) -> &Octs

Returns a reference to the underlying octets.

The octets contain the key tag value in its wire format: a sequence of u16 in network byte order.

source

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

Converts the value to the underlying octets.

The octets contain the key tag value in its wire format: a sequence of u16 in network byte order.

source

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

Returns a slice of the underlying octets.

The slice will contain the key tag value in its wire format: a sequence of u16 in network byte order.

source

pub fn as_slice_mut(&mut self) -> &mut [u8]
where Octs: AsMut<[u8]>,

Returns a mutable slice of the underlying octets.

The slice will contain the key tag value in its wire format: a sequence of u16 in network byte order.

source

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

Returns an iterator over the individual key tags.

Trait Implementations§

source§

impl<Octs: AsMut<[u8]> + ?Sized> AsMut<[u8]> for KeyTag<Octs>

source§

fn as_mut(&mut self) -> &mut [u8]

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

impl<Octs: AsRef<[u8]> + ?Sized> AsRef<[u8]> for KeyTag<Octs>

source§

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

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

impl<Octs: AsRef<[u8]> + ?Sized> Borrow<[u8]> for KeyTag<Octs>

source§

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

Immutably borrows from an owned value. Read more
source§

impl<Octs> BorrowMut<[u8]> for KeyTag<Octs>
where Octs: AsMut<[u8]> + AsRef<[u8]> + ?Sized,

source§

fn borrow_mut(&mut self) -> &mut [u8]

Mutably borrows from an owned value. Read more
source§

impl<Octs: Clone + ?Sized> Clone for KeyTag<Octs>

source§

fn clone(&self) -> KeyTag<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<Octs: AsRef<[u8]> + ?Sized> ComposeOptData for KeyTag<Octs>

source§

fn compose_len(&self) -> u16

source§

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

source§

impl<Octets: AsRef<[u8]> + ?Sized> Debug for KeyTag<Octets>

source§

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

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

impl<Octets: AsRef<[u8]> + ?Sized> Display for KeyTag<Octets>

source§

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

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

impl<Octs, Name> From<KeyTag<Octs>> for AllOptData<Octs, Name>

source§

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

Converts to this type from the input type.
source§

impl<Octs: AsRef<[u8]> + ?Sized> Hash for KeyTag<Octs>

source§

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

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

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

§

type Item = u16

The type of the elements being iterated over.
§

type IntoIter = KeyTagIter<'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<Octs: ?Sized> OptData for KeyTag<Octs>

source§

fn code(&self) -> OptionCode

Returns the option code associated with this option.
source§

impl<Octs: AsRef<[u8]> + ?Sized> Ord for KeyTag<Octs>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl<'a, Octs: Octets> ParseOptData<'a, Octs> for KeyTag<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<Octs, Other> PartialEq<Other> for KeyTag<Octs>
where Octs: AsRef<[u8]> + ?Sized, Other: AsRef<[u8]> + ?Sized,

source§

fn eq(&self, other: &Other) -> 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<Octs, Other> PartialOrd<Other> for KeyTag<Octs>
where Octs: AsRef<[u8]> + ?Sized, Other: AsRef<[u8]> + ?Sized,

source§

fn partial_cmp(&self, other: &Other) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<Octs: AsRef<[u8]> + ?Sized> Eq for KeyTag<Octs>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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