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>
impl<Octs> KeyTag<Octs>
Sourcepub fn from_octets(octets: Octs) -> Result<Self, ParseError>
pub fn from_octets(octets: Octs) -> Result<Self, ParseError>
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.
Sourcepub unsafe fn from_octets_unchecked(octets: Octs) -> Self
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.
pub fn parse<'a, Src: Octets<Range<'a> = Octs> + ?Sized>( parser: &mut Parser<'a, Src>, ) -> Result<Self, ParseError>
Source§impl KeyTag<[u8]>
impl KeyTag<[u8]>
Sourcepub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>
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.
Sourcepub unsafe fn from_slice_unchecked(slice: &[u8]) -> &Self
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>
impl<Octs: ?Sized> KeyTag<Octs>
Sourcepub fn as_octets(&self) -> &Octs
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.
Sourcepub fn into_octets(self) -> Octswhere
Octs: Sized,
pub fn into_octets(self) -> Octswhere
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.
Sourcepub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_slice(&self) -> &[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.
Sourcepub fn as_slice_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_slice_mut(&mut self) -> &mut [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.