pub trait ToRelativeDname: Compose + for<'a> ToLabelIter<'a> {
    fn to_relative_dname<Octets>(
        &self
    ) -> Result<RelativeDname<Octets>, PushError>
   where
        Octets: FromBuilder,
        <Octets as FromBuilder>::Builder: EmptyBuilder
, { ... } fn as_flat_slice(&self) -> Option<&[u8]> { ... } fn to_cow(&self) -> RelativeDname<Cow<'_, [u8]>> { ... } fn to_vec(&self) -> RelativeDname<Vec<u8>> { ... } fn to_bytes(&self) -> RelativeDname<Bytes> { ... } fn is_empty(&self) -> bool { ... } fn chain<N: ToEitherDname>(
        self,
        suffix: N
    ) -> Result<Chain<Self, N>, LongChainError>
   where
        Self: Sized
, { ... } fn chain_root(self) -> Chain<Self, Dname<&'static [u8]>>
   where
        Self: Sized
, { ... } fn name_eq<N: ToRelativeDname + ?Sized>(&self, other: &N) -> bool { ... } fn name_cmp<N: ToRelativeDname + ?Sized>(&self, other: &N) -> Ordering { ... } }
Expand description

A type that represents a relative domain name.

In order to be a relative domain name, a type needs to be able to provide a sequence of labels via an iterator where the last label is not the root label. The type also needs to be able to compose the wire-format representation of the domain name it represents which must not be longer than 254 characters. This limit has been chosen so that by attaching the one character long root label, a valid absolute name can be constructed from the relative name.

The most important types implementing this trait are RelativeDname and Chain<L,R> where R is a ToRelativeDname itself.

Provided Methods

Converts the name into a single, continous name.

The canonical implementation provided by the trait iterates over the labels of the name and adds them one by one to RelativeDname. This will work for any name but an optimized implementation can be provided for some types of names.

Returns a byte slice of the content if possible.

This method can is used to optimize comparision operations between two values that are indeed flat names.

Returns a cow of the relative domain name.

If the name is available as one single slice – i.e., as_flat_slice returns ‘some,’ creates the borrowed variant from that slice. Otherwise assembles an owned variant via to_dname.

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

Returns the domain name assembled into a bytes value.

Returns whether the name is empty.

Returns a chain of this name and the provided name.

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

Tests whether self and other are equal.

This method can be used to implement PartialEq on types implementing ToDname since a blanket implementation for all pairs of ToDname is currently impossible.

Domain names are compared ignoring ASCII case.

Returns the ordering between self and other.

This method can be used to implement both PartialOrd and Ord on types implementing ToDname since a blanket implementation for all pairs of ToDnames is currently not possible.

Domain name order is determined according to the ‘canonical DNS name order’ as defined in section 6.1 of RFC 4034. This section describes how absolute domain names are ordered only. We will order relative domain names according to these rules as if they had the same origin, i.e., as if they were relative to the same name.

Implementations on Foreign Types

Implementors