[−][src]Enum domain::base::name::UncertainDname
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]
Octets: From<&'static [u8]>,
Creates a new uncertain domain name containing the root label only.
pub fn empty() -> Self where
Octets: From<&'static [u8]>,
[src]
Octets: From<&'static [u8]>,
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]
Octets: FromBuilder,
<Octets as FromBuilder>::Builder: EmptyBuilder,
C: IntoIterator<Item = char>,
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]
self
) -> Result<Dname<<<Octets as IntoBuilder>::Builder as IntoOctets>::Octets>, PushError> where
Octets: AsRef<[u8]> + IntoBuilder,
<Octets as IntoBuilder>::Builder: IntoOctets<Octets = Octets>,
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]
Octets: AsRef<[u8]>,
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]
self,
suffix: S
) -> Result<Chain<Self, S>, LongChainError> where
Octets: AsRef<[u8]>,
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]
fn clone(&self) -> UncertainDname<Octets>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Octets: AsRef<[u8]>> Compose for UncertainDname<Octets>
[src]
fn compose<T: OctetsBuilder>(&self, target: &mut T) -> Result<(), ShortBuf>
[src]
fn compose_canonical<T: OctetsBuilder>(
&self,
target: &mut T
) -> Result<(), ShortBuf>
[src]
&self,
target: &mut T
) -> Result<(), ShortBuf>
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]
fn from(src: RelativeDname<Octets>) -> Self
[src]
impl<Octets> FromStr for UncertainDname<Octets> where
Octets: FromBuilder,
<Octets as FromBuilder>::Builder: EmptyBuilder,
[src]
Octets: FromBuilder,
<Octets as FromBuilder>::Builder: EmptyBuilder,
type Err = FromStrError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl<Octets: AsRef<[u8]>> Hash for UncertainDname<Octets>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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?
fn into_iter(self) -> Self::IntoIter
[src]
impl<Octets, Other> PartialEq<UncertainDname<Other>> for UncertainDname<Octets> where
Octets: AsRef<[u8]>,
Other: AsRef<[u8]>,
[src]
Octets: AsRef<[u8]>,
Other: AsRef<[u8]>,
fn eq(&self, other: &UncertainDname<Other>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[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
fn iter_labels(&'a self) -> Self::LabelIter
[src]
fn len(&'a self) -> usize
[src]
fn starts_with<N: ToLabelIter<'a> + ?Sized>(&'a self, base: &'a N) -> bool
[src]
fn ends_with<N: ToLabelIter<'a> + ?Sized>(&'a self, base: &'a N) -> bool
[src]
Auto Trait Implementations
impl<Octets> RefUnwindSafe for UncertainDname<Octets> where
Octets: RefUnwindSafe,
Octets: RefUnwindSafe,
impl<Octets> Send for UncertainDname<Octets> where
Octets: Send,
Octets: Send,
impl<Octets> Sync for UncertainDname<Octets> where
Octets: Sync,
Octets: Sync,
impl<Octets> Unpin for UncertainDname<Octets> where
Octets: Unpin,
Octets: Unpin,
impl<Octets> UnwindSafe for UncertainDname<Octets> where
Octets: UnwindSafe,
Octets: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,