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>where
Octs: AsRef<[u8]>,
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.
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] ⓘwhere
Octs: AsRef<[u8]>,
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.
Trait Implementations§
source§impl<Octs: AsRef<[u8]> + ?Sized> ComposeOptData for KeyTag<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> ComposeOptData for KeyTag<Octs>
fn compose_len(&self) -> u16
fn compose_option<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target ) -> Result<(), Target::AppendError>
source§impl<Octs, Name> From<KeyTag<Octs>> for AllOptData<Octs, Name>
impl<Octs, Name> From<KeyTag<Octs>> for AllOptData<Octs, Name>
source§impl<Octs: ?Sized> OptData for KeyTag<Octs>
impl<Octs: ?Sized> OptData for KeyTag<Octs>
source§fn code(&self) -> OptionCode
fn code(&self) -> OptionCode
source§impl<'a, Octs: Octets> ParseOptData<'a, Octs> for KeyTag<Octs::Range<'a>>
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>
fn parse_option( code: OptionCode, parser: &mut Parser<'a, Octs> ) -> Result<Option<Self>, ParseError>
source§impl<Octs, Other> PartialEq<Other> for KeyTag<Octs>where
Octs: AsRef<[u8]> + ?Sized,
Other: AsRef<[u8]> + ?Sized,
impl<Octs, Other> PartialEq<Other> for KeyTag<Octs>where Octs: AsRef<[u8]> + ?Sized, Other: AsRef<[u8]> + ?Sized,
source§impl<Octs, Other> PartialOrd<Other> for KeyTag<Octs>where
Octs: AsRef<[u8]> + ?Sized,
Other: AsRef<[u8]> + ?Sized,
impl<Octs, Other> PartialOrd<Other> for KeyTag<Octs>where Octs: AsRef<[u8]> + ?Sized, Other: AsRef<[u8]> + ?Sized,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more