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>
impl<Octs> KeyTag<Octs>
Sourcepub fn from_octets(octets: Octs) -> Result<KeyTag<Octs>, ParseError>
pub fn from_octets(octets: Octs) -> Result<KeyTag<Octs>, 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) -> KeyTag<Octs>
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.
pub fn parse<'a, Src>( parser: &mut Parser<'a, Src>, ) -> Result<KeyTag<Octs>, ParseError>
Source§impl KeyTag<[u8]>
impl KeyTag<[u8]>
Sourcepub fn from_slice(slice: &[u8]) -> Result<&KeyTag<[u8]>, ParseError>
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§impl<Octs> KeyTag<Octs>where
Octs: ?Sized,
impl<Octs> KeyTag<Octs>where
Octs: ?Sized,
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.