Skip to main content

KeyTag

Struct KeyTag 

Source
pub struct KeyTag<Octs>
where 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<KeyTag<Octs>, 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) -> KeyTag<Octs>

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>( parser: &mut Parser<'a, Src>, ) -> Result<KeyTag<Octs>, ParseError>
where Src: Octets<Range<'a> = Octs> + ?Sized,

Source§

impl KeyTag<[u8]>

Source

pub fn from_slice(slice: &[u8]) -> Result<&KeyTag<[u8]>, 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]) -> &KeyTag<[u8]>

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> KeyTag<Octs>
where Octs: ?Sized,

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]> for KeyTag<Octs>
where Octs: AsMut<[u8]> + ?Sized,

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]> for KeyTag<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<Octs> Borrow<[u8]> for KeyTag<Octs>
where Octs: AsRef<[u8]> + ?Sized,

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 for KeyTag<Octs>
where Octs: Clone + ?Sized,

Source§

fn clone(&self) -> KeyTag<Octs>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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

Source§

fn compose_len(&self) -> u16

Source§

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

Source§

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

Source§

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

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

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

Source§

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

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

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

Source§

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

Source§

fn from(value: KeyTag<Octs>) -> AllOptData<Octs, Name>

Converts to this type from the input type.
Source§

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

Source§

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

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, Octs> IntoIterator for &'a KeyTag<Octs>
where Octs: AsRef<[u8]> + ?Sized,

Source§

type Item = u16

The type of the elements being iterated over.
Source§

type IntoIter = KeyTagIter<'a>

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

fn into_iter(self) -> <&'a KeyTag<Octs> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<Octs, SrcOcts> OctetsFrom<KeyTag<SrcOcts>> for KeyTag<Octs>
where Octs: OctetsFrom<SrcOcts>,

Source§

type Error = <Octs as OctetsFrom<SrcOcts>>::Error

Source§

fn try_octets_from( src: KeyTag<SrcOcts>, ) -> Result<KeyTag<Octs>, <KeyTag<Octs> as OctetsFrom<KeyTag<SrcOcts>>>::Error>

Performs the conversion.
Source§

fn octets_from(source: Source) -> Self
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
Source§

impl<Octs> OptData for KeyTag<Octs>
where Octs: ?Sized,

Source§

fn code(&self) -> OptionCode

Returns the option code associated with this option.
Source§

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

Source§

fn cmp(&self, other: &KeyTag<Octs>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<'a, Octs> ParseOptData<'a, Octs> for KeyTag<<Octs as Octets>::Range<'a>>
where Octs: Octets,

Source§

fn parse_option( code: OptionCode, parser: &mut Parser<'a, Octs>, ) -> Result<Option<KeyTag<<Octs as Octets>::Range<'a>>>, 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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

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 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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> UnsafeUnpin for KeyTag<Octs>
where Octs: UnsafeUnpin + ?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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.