pub struct Nsid<Octs: ?Sized> { /* private fields */ }
Expand description
Option data for the Name Server Identifier (NSID) Option.
This option allows identifying a particular name server that has answered a query. If a client is interested in this information, it includes an empty NSID option in its query. If the server supports the option, it includes it in its response with byte string identifying the server.
The option and details about its use are defined in RFC 5001.
Implementations§
source§impl<Octs> Nsid<Octs>
impl<Octs> Nsid<Octs>
sourcepub fn from_octets(octets: Octs) -> Result<Self, LongOptData>
pub fn from_octets(octets: Octs) -> Result<Self, LongOptData>
Creates a value from the ocets of the name server identifier.
The function returns an error if octets
is longer than 65,535
octets.
sourcepub unsafe fn from_octets_unchecked(octets: Octs) -> Self
pub unsafe fn from_octets_unchecked(octets: Octs) -> Self
Creates a value from the name server identifier without checking.
§Safety
The caller has to make sure that octets
is no longer than 65,535
octets.
source§impl Nsid<[u8]>
impl Nsid<[u8]>
sourcepub fn from_slice(slice: &[u8]) -> Result<&Self, LongOptData>
pub fn from_slice(slice: &[u8]) -> Result<&Self, LongOptData>
Creates a value for a slice of the name server identifer.
The function returns an error if slice
is longer than 65,535
octets.
sourcepub unsafe fn from_slice_unchecked(slice: &[u8]) -> &Self
pub unsafe fn from_slice_unchecked(slice: &[u8]) -> &Self
Creates a value for a slice without checking.
§Safety
The caller has to make sure that octets
is no longer than 65,535
octets.
sourcepub fn empty() -> &'static Self
pub fn empty() -> &'static Self
Creates an empty NSID option value.
Trait Implementations§
source§impl<Octs: AsRef<[u8]> + ?Sized> ComposeOptData for Nsid<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> ComposeOptData for Nsid<Octs>
fn compose_len(&self) -> u16
fn compose_option<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
source§impl<Octs, Name> From<Nsid<Octs>> for AllOptData<Octs, Name>
impl<Octs, Name> From<Nsid<Octs>> for AllOptData<Octs, Name>
source§impl<Octs: ?Sized> OptData for Nsid<Octs>
impl<Octs: ?Sized> OptData for Nsid<Octs>
source§fn code(&self) -> OptionCode
fn code(&self) -> OptionCode
source§impl<'a, Octs: Octets> ParseOptData<'a, Octs> for Nsid<Octs::Range<'a>>
impl<'a, Octs: Octets> ParseOptData<'a, Octs> for Nsid<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 Nsid<Octs>
impl<Octs, Other> PartialEq<Other> for Nsid<Octs>
source§impl<Octs, Other> PartialOrd<Other> for Nsid<Octs>
impl<Octs, Other> PartialOrd<Other> for Nsid<Octs>
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