Struct trust_dns_client::rr::LowerName [−][src]
them should be through references. As a workaround the Strings are all Rc as well as the array
Implementations
impl LowerName
[src]
pub fn new(name: &Name) -> Self
[src]
Create a new domain::LowerName, i.e. label
pub fn is_root(&self) -> bool
[src]
Returns true if there are no labels, i.e. it’s empty.
In DNS the root is represented by .
Examples
use trust_dns_client::rr::{LowerName, Name}; let root = LowerName::from(Name::root()); assert_eq!(&root.to_string(), ".");
pub fn is_fqdn(&self) -> bool
[src]
Returns true if the name is a fully qualified domain name.
If this is true, it has effects like only querying for this single name, as opposed to building up a search list in resolvers.
warning: this interface is unstable and may change in the future
Examples
use std::str::FromStr; use trust_dns_client::rr::{LowerName, Name}; let name = LowerName::from(Name::from_str("www").unwrap()); assert!(!name.is_fqdn()); let name = LowerName::from(Name::from_str("www.example.com").unwrap()); assert!(!name.is_fqdn()); let name = LowerName::from(Name::from_str("www.example.com.").unwrap()); assert!(name.is_fqdn());
pub fn base_name(&self) -> LowerName
[src]
Trims off the first part of the name, to help with searching for the domain piece
Examples
use std::str::FromStr; use trust_dns_client::rr::{LowerName, Name}; let example_com = LowerName::from(Name::from_str("example.com").unwrap()); assert_eq!(example_com.base_name(), LowerName::from(Name::from_str("com.").unwrap())); assert_eq!(LowerName::from(Name::from_str("com.").unwrap().base_name()), LowerName::from(Name::root())); assert_eq!(LowerName::from(Name::root().base_name()), LowerName::from(Name::root()));
pub fn zone_of(&self, name: &Self) -> bool
[src]
returns true if the name components of self are all present at the end of name
Example
use std::str::FromStr; use trust_dns_client::rr::{LowerName, Name}; let name = LowerName::from(Name::from_str("www.example.com").unwrap()); let zone = LowerName::from(Name::from_str("example.com").unwrap()); let another = LowerName::from(Name::from_str("example.net").unwrap()); assert!(zone.zone_of(&name)); assert!(!another.zone_of(&name));
pub fn num_labels(&self) -> u8
[src]
Returns the number of labels in the name, discounting *
.
Examples
use std::str::FromStr; use trust_dns_client::rr::{LowerName, Name}; let root = LowerName::from(Name::root()); assert_eq!(root.num_labels(), 0); let example_com = LowerName::from(Name::from_str("example.com").unwrap()); assert_eq!(example_com.num_labels(), 2); let star_example_com = LowerName::from(Name::from_str("*.example.com").unwrap()); assert_eq!(star_example_com.num_labels(), 2);
pub fn len(&self) -> usize
[src]
returns the length in bytes of the labels. ‘.’ counts as 1
This can be used as an estimate, when serializing labels, they will often be compressed and/or escaped causing the exact length to be different.
pub fn is_empty(&self) -> bool
[src]
Returns true if the name is empty
pub fn emit_as_canonical(
&self,
encoder: &mut BinEncoder<'_>,
canonical: bool
) -> ProtoResult<()>
[src]
&self,
encoder: &mut BinEncoder<'_>,
canonical: bool
) -> ProtoResult<()>
Emits the canonical version of the name to the encoder.
In canonical form, there will be no pointers written to the encoder (i.e. no compression).
pub fn is_wildcard(&self) -> bool
[src]
Pass through for Name::is_wildcard
pub fn into_wildcard(self) -> Self
[src]
Replaces the first label with the wildcard character, “*”
Trait Implementations
impl<'r> BinDecodable<'r> for LowerName
[src]
fn read(decoder: &mut BinDecoder<'r>) -> ProtoResult<LowerName>
[src]
parses the chain of labels this has a max of 255 octets, with each label being less than 63. all names will be stored lowercase internally. This will consume the portions of the Vec which it is reading…
pub fn from_bytes(bytes: &'r [u8]) -> Result<Self, ProtoError>
[src]
impl BinEncodable for LowerName
[src]
fn emit(&self, encoder: &mut BinEncoder<'_>) -> ProtoResult<()>
[src]
pub fn to_bytes(&self) -> Result<Vec<u8, Global>, ProtoError>
[src]
impl Borrow<Name> for LowerName
[src]
impl Clone for LowerName
[src]
impl Debug for LowerName
[src]
impl Default for LowerName
[src]
impl Display for LowerName
[src]
impl Eq for LowerName
[src]
impl<'a> From<&'a LowerName> for Name
[src]
impl<'a> From<&'a Name> for LowerName
[src]
impl From<LowerName> for Name
[src]
impl From<Name> for LowerName
[src]
impl FromStr for LowerName
[src]
type Err = ProtoError
The associated error which can be returned from parsing.
fn from_str(name: &str) -> Result<Self, Self::Err>
[src]
impl Hash for LowerName
[src]
fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Index<usize> for LowerName
[src]
impl Ord for LowerName
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
Given two lower cased names, this performs a case sensitive comparison.
RFC 4034 DNSSEC Resource Records March 2005
6.1. Canonical DNS LowerName Order
For the purposes of DNS security, owner names are ordered by treating
individual labels as unsigned left-justified octet strings. The
absence of a octet sorts before a zero value octet, and uppercase
US-ASCII letters are treated as if they were lowercase US-ASCII
letters.
To compute the canonical ordering of a set of DNS names, start by
sorting the names according to their most significant (rightmost)
labels. For names in which the most significant label is identical,
continue sorting according to their next most significant label, and
so forth.
For example, the following names are sorted in canonical DNS name
order. The most significant label is "example". At this level,
"example" sorts first, followed by names ending in "a.example", then
by names ending "z.example". The names within each level are sorted
in the same way.
example
a.example
yljkjljk.a.example
Z.a.example
zABC.a.EXAMPLE
z.example
\001.z.example
*.z.example
\200.z.example
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<LowerName> for LowerName
[src]
impl PartialOrd<LowerName> for LowerName
[src]
fn partial_cmp(&self, other: &LowerName) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for LowerName
[src]
Auto Trait Implementations
impl RefUnwindSafe for LowerName
impl Send for LowerName
impl Sync for LowerName
impl Unpin for LowerName
impl UnwindSafe for LowerName
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,
pub 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> IntoName for T where
T: Into<Name>,
[src]
T: Into<Name>,
pub fn into_name(self) -> Result<Name, ProtoError>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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.
pub 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>,