Struct domain::base::opt::nsid::Nsid

source ·
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>

source

pub fn from_octets(octets: Octs) -> Result<Self, LongOptData>
where Octs: AsRef<[u8]>,

Creates a value from the ocets of the name server identifier.

The function returns an error if octets is longer than 65,535 octets.

source

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

pub fn parse<'a, Src: Octets<Range<'a> = Octs> + ?Sized>( parser: &mut Parser<'a, Src>, ) -> Result<Self, ParseError>

Parses a value from its wire format.

source§

impl Nsid<[u8]>

source

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.

source

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.

source

pub fn empty() -> &'static Self

Creates an empty NSID option value.

source§

impl<Octs: ?Sized> Nsid<Octs>

source

pub fn as_octets(&self) -> &Octs

Returns a reference to the octets with the server identifier.

source

pub fn into_octets(self) -> Octs
where Octs: Sized,

Converts the value into the octets with the server identifier.

source

pub fn as_slice(&self) -> &[u8]
where Octs: AsRef<[u8]>,

Returns a slice of the server identifier.

source

pub fn for_slice(&self) -> &Nsid<[u8]>
where Octs: AsRef<[u8]>,

Returns a value over an octets slice.

Trait Implementations§

source§

impl<Octs: AsRef<[u8]> + ?Sized> AsRef<[u8]> for Nsid<Octs>

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<Octs: AsRef<[u8]> + ?Sized> Borrow<[u8]> for Nsid<Octs>

source§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
source§

impl<Octs: Clone + ?Sized> Clone for Nsid<Octs>

source§

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

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<Octs: AsRef<[u8]> + ?Sized> ComposeOptData for Nsid<Octs>

source§

fn compose_len(&self) -> u16

source§

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

source§

impl<Octs: AsRef<[u8]> + ?Sized> Debug for Nsid<Octs>

source§

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

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

impl<Octs: AsRef<[u8]> + ?Sized> Display for Nsid<Octs>

source§

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

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

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

source§

fn from(value: Nsid<Octs>) -> Self

Converts to this type from the input type.
source§

impl<Octs: AsRef<[u8]> + ?Sized> Hash for Nsid<Octs>

source§

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

Feeds this value into the given Hasher. Read more
source§

impl<Octs: ?Sized> OptData for Nsid<Octs>

source§

fn code(&self) -> OptionCode

Returns the option code associated with this option.
source§

impl<Octs: AsRef<[u8]> + ?Sized> Ord for Nsid<Octs>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
source§

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>

Parses the option code data. Read more
source§

impl<Octs, Other> PartialEq<Other> for Nsid<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 · 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 Nsid<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 · 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 · 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 · 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 · 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
source§

impl<Octs: Copy + ?Sized> Copy for Nsid<Octs>

source§

impl<Octs: AsRef<[u8]> + ?Sized> Eq for Nsid<Octs>

Auto Trait Implementations§

§

impl<Octs> Freeze for Nsid<Octs>
where Octs: Freeze + ?Sized,

§

impl<Octs> RefUnwindSafe for Nsid<Octs>
where Octs: RefUnwindSafe + ?Sized,

§

impl<Octs> Send for Nsid<Octs>
where Octs: Send + ?Sized,

§

impl<Octs> Sync for Nsid<Octs>
where Octs: Sync + ?Sized,

§

impl<Octs> Unpin for Nsid<Octs>
where Octs: Unpin + ?Sized,

§

impl<Octs> UnwindSafe for Nsid<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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more