Struct domain::base::name::Chain

source ·
pub struct Chain<L, R> { /* private fields */ }
Expand description

Two domain names chained together.

This type is the result of calling the chain method on RelativeDname, UncertainDname, or on Chain itself.

The chain can be both an absolute or relative domain name—and implements the respective traits ToDname or ToRelativeDname—, depending on whether the second name is absolute or relative.

A chain on an uncertain name is special in that the second name is only used if the uncertain name is relative.

Implementations§

source§

impl<L, R> Chain<L, R>

source

pub fn scan<S: Scanner<Dname = Self>>(scanner: &mut S) -> Result<Self, S::Error>

source§

impl<L: ToRelativeDname, R: ToLabelIter> Chain<L, R>

source

pub fn chain<N: ToLabelIter>( self, other: N ) -> Result<Chain<Self, N>, LongChainError>

Extends the chain with another domain name.

While the method accepts anything Compose as the second element of the chain, the resulting Chain will only implement ToDname or ToRelativeDname if if also implements ToDname or ToRelativeDname, respectively.

The method will fail with an error if the chained name is longer than 255 bytes.

source§

impl<L, R> Chain<L, R>

source

pub fn unwrap(self) -> (L, R)

Unwraps the chain into its two constituent components.

Trait Implementations§

source§

impl<L: Clone, R: Clone> Clone for Chain<L, R>

source§

fn clone(&self) -> Chain<L, R>

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<L: Debug, R: Debug> Debug for Chain<L, R>

source§

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

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

impl<L: Display, R: Display> Display for Chain<L, R>

source§

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

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

impl<L: ToRelativeDname, R: ToDname> ToDname for Chain<L, R>

source§

fn to_dname<Octets>(&self) -> Result<Dname<Octets>, PushError>where Octets: FromBuilder, <Octets as FromBuilder>::Builder: EmptyBuilder,

Converts the name into a single, uncompressed name. Read more
source§

fn to_canonical_dname<Octets>(&self) -> Result<Dname<Octets>, PushError>where Octets: FromBuilder, <Octets as FromBuilder>::Builder: EmptyBuilder,

Converts the name into a single name in canonical form.
source§

fn as_flat_slice(&self) -> Option<&[u8]>

Returns an octets slice of the content if possible. Read more
source§

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

source§

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

source§

fn to_cow(&self) -> Dname<Cow<'_, [u8]>>

Returns a cow of the domain name. Read more
source§

fn to_vec(&self) -> Dname<Vec<u8>>

Returns the domain name assembled into a Vec<u8>.
source§

fn to_bytes(&self) -> Dname<Bytes>

Returns the domain name assembled into a bytes value.
source§

fn name_eq<N: ToDname + ?Sized>(&self, other: &N) -> bool

Tests whether self and other are equal. Read more
source§

fn name_cmp<N: ToDname + ?Sized>(&self, other: &N) -> Ordering

Returns the ordering between self and other. Read more
source§

fn composed_cmp<N: ToDname + ?Sized>(&self, other: &N) -> Ordering

Returns the composed name ordering.
source§

fn lowercase_composed_cmp<N: ToDname + ?Sized>(&self, other: &N) -> Ordering

Returns the lowercase composed ordering.
source§

fn rrsig_label_count(&self) -> u8

Returns the number of labels for the RRSIG Labels field. Read more
source§

impl<Octets, R> ToDname for Chain<UncertainDname<Octets>, R>where Octets: AsRef<[u8]>, R: ToDname,

source§

fn to_dname<Octets>(&self) -> Result<Dname<Octets>, PushError>where Octets: FromBuilder, <Octets as FromBuilder>::Builder: EmptyBuilder,

Converts the name into a single, uncompressed name. Read more
source§

fn to_canonical_dname<Octets>(&self) -> Result<Dname<Octets>, PushError>where Octets: FromBuilder, <Octets as FromBuilder>::Builder: EmptyBuilder,

Converts the name into a single name in canonical form.
source§

fn as_flat_slice(&self) -> Option<&[u8]>

Returns an octets slice of the content if possible. Read more
source§

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

source§

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

source§

fn to_cow(&self) -> Dname<Cow<'_, [u8]>>

Returns a cow of the domain name. Read more
source§

fn to_vec(&self) -> Dname<Vec<u8>>

Returns the domain name assembled into a Vec<u8>.
source§

fn to_bytes(&self) -> Dname<Bytes>

Returns the domain name assembled into a bytes value.
source§

fn name_eq<N: ToDname + ?Sized>(&self, other: &N) -> bool

Tests whether self and other are equal. Read more
source§

fn name_cmp<N: ToDname + ?Sized>(&self, other: &N) -> Ordering

Returns the ordering between self and other. Read more
source§

fn composed_cmp<N: ToDname + ?Sized>(&self, other: &N) -> Ordering

Returns the composed name ordering.
source§

fn lowercase_composed_cmp<N: ToDname + ?Sized>(&self, other: &N) -> Ordering

Returns the lowercase composed ordering.
source§

fn rrsig_label_count(&self) -> u8

Returns the number of labels for the RRSIG Labels field. Read more
source§

impl<L: ToRelativeDname, R: ToLabelIter> ToLabelIter for Chain<L, R>

§

type LabelIter<'a> = ChainIter<'a, L, R> where L: 'a, R: 'a

The type of the iterator over the labels. Read more
source§

fn iter_labels(&self) -> Self::LabelIter<'_>

Returns an iterator over the labels.
source§

fn compose_len(&self) -> u16

Returns the length in octets of the encoded name.
source§

fn starts_with<N: ToLabelIter + ?Sized>(&self, base: &N) -> bool

Determines whether base is a prefix of self.
source§

fn ends_with<N: ToLabelIter + ?Sized>(&self, base: &N) -> bool

Determines whether base is a suffix of self.
source§

impl<Octs, R> ToLabelIter for Chain<UncertainDname<Octs>, R>where Octs: AsRef<[u8]>, R: ToDname,

§

type LabelIter<'a> = UncertainChainIter<'a, Octs, R> where Octs: 'a, R: 'a

The type of the iterator over the labels. Read more
source§

fn iter_labels(&self) -> Self::LabelIter<'_>

Returns an iterator over the labels.
source§

fn compose_len(&self) -> u16

Returns the length in octets of the encoded name.
source§

fn starts_with<N: ToLabelIter + ?Sized>(&self, base: &N) -> bool

Determines whether base is a prefix of self.
source§

fn ends_with<N: ToLabelIter + ?Sized>(&self, base: &N) -> bool

Determines whether base is a suffix of self.
source§

impl<L: ToRelativeDname, R: ToRelativeDname> ToRelativeDname for Chain<L, R>

source§

fn to_relative_dname<Octets>(&self) -> Result<RelativeDname<Octets>, PushError>where Octets: FromBuilder, <Octets as FromBuilder>::Builder: EmptyBuilder,

Converts the name into a single, continous name. Read more
source§

fn to_canonical_relative_dname<Octets>( &self ) -> Result<RelativeDname<Octets>, PushError>where Octets: FromBuilder, <Octets as FromBuilder>::Builder: EmptyBuilder,

Converts the name into a single name in canonical form.
source§

fn as_flat_slice(&self) -> Option<&[u8]>

Returns a byte slice of the content if possible. Read more
source§

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

source§

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

source§

fn to_cow(&self) -> RelativeDname<Cow<'_, [u8]>>

Returns a cow of the relative domain name. Read more
source§

fn to_vec(&self) -> RelativeDname<Vec<u8>>

Returns the domain name assembled into a Vec<u8>.
source§

fn to_bytes(&self) -> RelativeDname<Bytes>

Returns the domain name assembled into a bytes value.
source§

fn is_empty(&self) -> bool

Returns whether the name is empty.
source§

fn chain<N: ToLabelIter>( self, suffix: N ) -> Result<Chain<Self, N>, LongChainError>where Self: Sized,

Returns a chain of this name and the provided name.
source§

fn chain_root(self) -> Chain<Self, Dname<&'static [u8]>>where Self: Sized,

Returns the absolute name by chaining it with the root label.
source§

fn name_eq<N: ToRelativeDname + ?Sized>(&self, other: &N) -> bool

Tests whether self and other are equal. Read more
source§

fn name_cmp<N: ToRelativeDname + ?Sized>(&self, other: &N) -> Ordering

Returns the ordering between self and other. Read more

Auto Trait Implementations§

§

impl<L, R> RefUnwindSafe for Chain<L, R>where L: RefUnwindSafe, R: RefUnwindSafe,

§

impl<L, R> Send for Chain<L, R>where L: Send, R: Send,

§

impl<L, R> Sync for Chain<L, R>where L: Sync, R: Sync,

§

impl<L, R> Unpin for Chain<L, R>where L: Unpin, R: Unpin,

§

impl<L, R> UnwindSafe for Chain<L, R>where L: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Sourcewhere 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) -> Targetwhere Self::Error: Into<Infallible>,

Performs an infallible conversion.
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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 Twhere 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 Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V