[−][src]Trait domain::base::ToDname
A type that represents an absolute domain name.
An absolute domain name is a sequence of labels where the last label is the root label and where the wire-format representation is not longer than 255 characters. Implementers of this trait need to provide access to the label sequence via an iterator and know how to compose the wire-format representation into a buffer.
The most common types implementing this trait are Dname
,
ParsedDname
, and Chain<L, R>
where R
is ToDname
itself.
Provided methods
fn to_dname<Octets>(&self) -> Result<Dname<Octets>, PushError> where
Octets: FromBuilder,
<Octets as FromBuilder>::Builder: EmptyBuilder,
Octets: FromBuilder,
<Octets as FromBuilder>::Builder: EmptyBuilder,
Converts the name into a single, uncompressed name.
The canonical implementation provided by the trait iterates over the
labels of the name and adds them one by one to Dname
. This will
work for any name but an optimized implementation can be provided for
some types of names.
fn as_flat_slice(&self) -> Option<&[u8]>
Returns an octets slice of the content if possible.
If a value stores the domain name as one single octets sequence, it
should return a reference to this sequence here. If the name is
composed from multiple such sequences, it should return None
.
This method is used to optimize comparision operations between two values that are indeed flat names.
fn to_cow(&self) -> Dname<Cow<[u8]>>
Returns a cow of the 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
.
fn to_vec(&self) -> Dname<Vec<u8>>
Returns the domain name assembled into a Vec<u8>
.
fn name_eq<N: ToDname + ?Sized>(&self, other: &N) -> bool
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.
fn name_cmp<N: ToDname + ?Sized>(&self, other: &N) -> Ordering
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 ToDname
s 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.
fn composed_cmp<N: ToDname + ?Sized>(&self, other: &N) -> Ordering
Returns the composed name ordering.
fn lowercase_composed_cmp<N: ToDname + ?Sized>(&self, other: &N) -> Ordering
Returns the lowercase composed ordering.
fn rrsig_label_count(&self) -> u8
Returns the number of labels for the RRSIG Labels field.
This is the actual number of labels without counting the root label or a possible initial asterisk label.
Implementations on Foreign Types
impl<'a, N: ToDname + ?Sized + 'a> ToDname for &'a N
[src]
Loading content...
Implementors
impl<L: ToRelativeDname, R: ToDname> ToDname for Chain<L, R>
[src]
impl<Octets, R> ToDname for Chain<UncertainDname<Octets>, R> where
Octets: AsRef<[u8]>,
R: ToDname,
[src]
Octets: AsRef<[u8]>,
R: ToDname,