Struct domain::base::name::OwnedLabel

source ·
pub struct OwnedLabel(/* private fields */);
Expand description

An owned label.

Since labels are relatively short, this type doesn’t actually allocate any memory but is a 64 octet array.

Implementations§

source§

impl OwnedLabel

source

pub fn from_label(label: &Label) -> Self

Creates a new owned label from an existing label.

source

pub fn from_chars( chars: impl Iterator<Item = char>, ) -> Result<Self, LabelFromStrError>

Creates a label from a sequence of chars.

source

pub fn make_canonical(&mut self)

Converts the label into the canonical form.

This form has all octets representing ASCII letters converted to their lower case form.

source

pub fn as_label(&self) -> &Label

Returns a reference to the label.

source

pub fn as_label_mut(&mut self) -> &mut Label

Returns a mutable reference to the label.

source

pub fn as_wire_slice(&self) -> &[u8]

Returns a slice that is the wire-representation of the label.

Methods from Deref<Target = Label>§

source

pub const MAX_LEN: usize = 63usize

source

pub fn iter(&self) -> Copied<Iter<'_, u8>>

Iterator over the octets of the label.

source

pub fn as_slice(&self) -> &[u8]

Returns a reference to the underlying octets slice.

source

pub fn as_slice_mut(&mut self) -> &mut [u8]

Returns a mutable reference to the underlying octets slice.

source

pub fn make_canonical(&mut self)

Converts the label into the canonical form.

This form has all octets representing ASCII letters converted to their lower case form.

source

pub fn to_canonical(&self) -> OwnedLabel

Returns the label in canonical form.

In this form, all ASCII letters are lowercase.

source

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

Returns the composed label ordering.

source

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

Returns the composed ordering with ASCII letters lowercased.

source

pub fn compose<Builder: OctetsBuilder + ?Sized>( &self, target: &mut Builder, ) -> Result<(), Builder::AppendError>

Appends the label to an octets builder.

The method builds the encoded form of the label that starts with a one octet length indicator.

source

pub fn compose_canonical<Builder: OctetsBuilder + ?Sized>( &self, target: &mut Builder, ) -> Result<(), Builder::AppendError>

Appends the lowercased label to an octets builder.

The method builds the encoded form of the label that starts with a one octet length indicator. It also converts all ASCII letters into their lowercase form.

source

pub fn len(&self) -> usize

Returns the length of the label.

This length is that of the label’s content only. It will not contain the initial label length octet present in the wire format.

source

pub fn is_empty(&self) -> bool

Returns whether this is the empty label.

source

pub fn is_root(&self) -> bool

Returns whether the label is the root label.

source

pub fn is_wildcard(&self) -> bool

Returns whether the label is the wildcard label.

source

pub fn compose_len(&self) -> u16

Returns the length of the composed version of the label.

This length is one more than the length of the label as their is a leading length octet.

Trait Implementations§

source§

impl AsMut<[u8]> for OwnedLabel

source§

fn as_mut(&mut self) -> &mut [u8]

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

impl AsMut<Label> for OwnedLabel

source§

fn as_mut(&mut self) -> &mut Label

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

impl AsRef<[u8]> for OwnedLabel

source§

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

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

impl AsRef<Label> for OwnedLabel

source§

fn as_ref(&self) -> &Label

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

impl Borrow<Label> for OwnedLabel

source§

fn borrow(&self) -> &Label

Immutably borrows from an owned value. Read more
source§

impl BorrowMut<Label> for OwnedLabel

source§

fn borrow_mut(&mut self) -> &mut Label

Mutably borrows from an owned value. Read more
source§

impl Clone for OwnedLabel

source§

fn clone(&self) -> OwnedLabel

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 Debug for OwnedLabel

source§

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

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

impl Deref for OwnedLabel

§

type Target = Label

The resulting type after dereferencing.
source§

fn deref(&self) -> &Label

Dereferences the value.
source§

impl DerefMut for OwnedLabel

source§

fn deref_mut(&mut self) -> &mut Label

Mutably dereferences the value.
source§

impl Display for OwnedLabel

source§

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

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

impl<'a> From<&'a Label> for OwnedLabel

source§

fn from(label: &'a Label) -> Self

Converts to this type from the input type.
source§

impl FromStr for OwnedLabel

§

type Err = LabelFromStrError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for OwnedLabel

source§

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

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

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for OwnedLabel

source§

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

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

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T: AsRef<Label>> PartialEq<T> for OwnedLabel

source§

fn eq(&self, other: &T) -> 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<T: AsRef<Label>> PartialOrd<T> for OwnedLabel

source§

fn partial_cmp(&self, other: &T) -> 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 Copy for OwnedLabel

source§

impl Eq for OwnedLabel

Auto Trait Implementations§

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