[−][src]Enum domain_core::bits::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)
Relative(RelativeDname)
Methods
impl UncertainDname
[src]
pub fn absolute(name: Dname) -> Self
[src]
Creates a new uncertain domain name from an absolute domain name.
pub fn relative(name: RelativeDname) -> Self
[src]
Creates a new uncertain domain name from a relative domain name.
pub fn root() -> Self
[src]
Creates a new uncertain domain name containing the root label only.
pub fn empty() -> Self
[src]
Creates a new uncertain yet empty domain name.
pub fn from_chars<C>(chars: C) -> Result<Self, FromStrError> where
C: IntoIterator<Item = char>,
[src]
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.
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>
[src]
Returns a reference to an absolute name, if this name is absolute.
pub fn as_relative(&self) -> Option<&RelativeDname>
[src]
Returns a reference to a relative name, if the name is relative.
pub fn try_into_absolute(self) -> Result<Dname, 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, Self>
[src]
Converts the name into a relative name if it is relative.
Otherwise just returns itself as the error.
pub fn into_absolute(self) -> Dname
[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 chain<S: ToDname>(
self,
suffix: S
) -> Result<Chain<Self, S>, LongChainError>
[src]
self,
suffix: S
) -> Result<Chain<Self, S>, LongChainError>
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
.
pub fn as_slice(&self) -> &[u8]
[src]
Returns a byte slice with the raw content of the name.
Trait Implementations
impl Compose for UncertainDname
[src]
impl<'a> ToLabelIter<'a> for UncertainDname
[src]
type LabelIter = DnameIter<'a>
The type of the iterator over the labels. Read more
fn iter_labels(&'a self) -> Self::LabelIter
[src]
fn starts_with<N: ToLabelIter<'a>>(&'a self, base: &'a N) -> bool
[src]
Determines whether base
is a prefix of self
.
fn ends_with<N: ToLabelIter<'a>>(&'a self, base: &'a N) -> bool
[src]
Determines whether base
is a suffix of self
.
impl Scan for UncertainDname
[src]
impl Eq for UncertainDname
[src]
impl Clone for UncertainDname
[src]
fn clone(&self) -> UncertainDname
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<UncertainDname> for UncertainDname
[src]
fn eq(&self, other: &UncertainDname) -> bool
[src]
fn ne(&self, other: &UncertainDname) -> bool
[src]
impl From<Dname> for UncertainDname
[src]
impl From<RelativeDname> for UncertainDname
[src]
fn from(name: RelativeDname) -> Self
[src]
impl Hash for UncertainDname
[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,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for UncertainDname
[src]
impl Display for UncertainDname
[src]
impl FromStr for UncertainDname
[src]
Auto Trait Implementations
impl Send for UncertainDname
impl Sync for UncertainDname
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,