[][src]Enum domain::base::name::UncertainDname

pub enum UncertainDname<Octets> {
    Absolute(Dname<Octets>),
    Relative(RelativeDname<Octets>),
}

A domain name that may be absolute or relative.

This type is helpful when reading a domain name from some source where it may end up being absolute or not.

Variants

Absolute(Dname<Octets>)
Relative(RelativeDname<Octets>)

Implementations

impl<Octets> UncertainDname<Octets>[src]

pub fn absolute(name: Dname<Octets>) -> Self[src]

Creates a new uncertain domain name from an absolute domain name.

pub fn relative(name: RelativeDname<Octets>) -> Self[src]

Creates a new uncertain domain name from a relative domain name.

pub fn root() -> Self where
    Octets: From<&'static [u8]>, 
[src]

Creates a new uncertain domain name containing the root label only.

pub fn empty() -> Self where
    Octets: From<&'static [u8]>, 
[src]

Creates a new uncertain yet empty domain name.

pub fn from_chars<C>(chars: C) -> Result<Self, FromStrError> where
    Octets: FromBuilder,
    <Octets as FromBuilder>::Builder: EmptyBuilder,
    C: IntoIterator<Item = char>, 
[src]

Creates a domain name from a sequence of characters.

The sequence must result in a domain name in master format representation. That is, its labels should be separated by dots, actual dots, white space and backslashes should be escaped by a preceeding backslash, and any byte value that is not a printable ASCII character should be encoded by a backslash followed by its three digit decimal value.

If the last character is a dot, the name will be absolute, otherwise it will be relative.

If you have a string, you can also use the FromStr trait, which really does the same thing.

impl UncertainDname<&'static [u8]>[src]

pub fn empty_ref() -> Self[src]

Creates an empty relative name atop a slice reference.

pub fn root_ref() -> Self[src]

Creates an absolute name that is the root label atop a slice reference.

impl UncertainDname<Vec<u8>>[src]

pub fn empty_vec() -> Self[src]

Creates an empty relative name atop a Vec<u8>.

pub fn root_vec() -> Self[src]

Creates an absolute name from the root label atop a Vec<u8>.

impl<Octets> UncertainDname<Octets>[src]

pub fn is_absolute(&self) -> bool[src]

Returns whether the name is absolute.

pub fn is_relative(&self) -> bool[src]

Returns whether the name is relative.

pub fn as_absolute(&self) -> Option<&Dname<Octets>>[src]

Returns a reference to an absolute name, if this name is absolute.

pub fn as_relative(&self) -> Option<&RelativeDname<Octets>>[src]

Returns a reference to a relative name, if the name is relative.

pub fn into_absolute(
    self
) -> Result<Dname<<<Octets as IntoBuilder>::Builder as IntoOctets>::Octets>, PushError> where
    Octets: AsRef<[u8]> + IntoBuilder,
    <Octets as IntoBuilder>::Builder: IntoOctets<Octets = Octets>, 
[src]

Converts the name into an absolute name.

If the name is relative, appends the root label to it using RelativeDname::into_absolute.

pub fn try_into_absolute(self) -> Result<Dname<Octets>, Self>[src]

Converts the name into an absolute name if it is absolute.

Otherwise, returns itself as the error.

pub fn try_into_relative(self) -> Result<RelativeDname<Octets>, Self>[src]

Converts the name into a relative name if it is relative.

Otherwise just returns itself as the error.

pub fn as_octets(&self) -> &Octets[src]

Returns a reference to the underlying octets sequence.

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

Returns an octets slice with the raw content of the name.

pub fn chain<S: ToEitherDname>(
    self,
    suffix: S
) -> Result<Chain<Self, S>, LongChainError> where
    Octets: AsRef<[u8]>, 
[src]

Makes an uncertain name absolute by chaining on a suffix if needed.

The method converts the uncertain name into a chain that will be absolute. If the name is already absolute, the chain will be the name itself. If it is relative, if will be the concatenation of the name and suffix.

Trait Implementations

impl<Octets: AsRef<T>, T> AsRef<T> for UncertainDname<Octets>[src]

impl<Octets: Clone> Clone for UncertainDname<Octets>[src]

impl<Octets: AsRef<[u8]>> Compose for UncertainDname<Octets>[src]

impl<Octets: AsRef<[u8]>> Debug for UncertainDname<Octets>[src]

impl<Octets: AsRef<[u8]>> Display for UncertainDname<Octets>[src]

impl<Octets: AsRef<[u8]>> Eq for UncertainDname<Octets>[src]

impl<Octets> From<Dname<Octets>> for UncertainDname<Octets>[src]

impl<Octets> From<RelativeDname<Octets>> for UncertainDname<Octets>[src]

impl<Octets> FromStr for UncertainDname<Octets> where
    Octets: FromBuilder,
    <Octets as FromBuilder>::Builder: EmptyBuilder
[src]

type Err = FromStrError

The associated error which can be returned from parsing.

impl<Octets: AsRef<[u8]>> Hash for UncertainDname<Octets>[src]

impl<'a, Octets: AsRef<[u8]>> IntoIterator for &'a UncertainDname<Octets>[src]

type Item = &'a Label

The type of the elements being iterated over.

type IntoIter = DnameIter<'a>

Which kind of iterator are we turning this into?

impl<Octets, Other> PartialEq<UncertainDname<Other>> for UncertainDname<Octets> where
    Octets: AsRef<[u8]>,
    Other: AsRef<[u8]>, 
[src]

impl<'a, Octets: AsRef<[u8]>> ToLabelIter<'a> for UncertainDname<Octets>[src]

type LabelIter = DnameIter<'a>

The type of the iterator over the labels. Read more

Auto Trait Implementations

impl<Octets> RefUnwindSafe for UncertainDname<Octets> where
    Octets: RefUnwindSafe

impl<Octets> Send for UncertainDname<Octets> where
    Octets: Send

impl<Octets> Sync for UncertainDname<Octets> where
    Octets: Sync

impl<Octets> Unpin for UncertainDname<Octets> where
    Octets: Unpin

impl<Octets> UnwindSafe for UncertainDname<Octets> where
    Octets: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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