Struct trust_dns::rr::LowerName[][src]

pub struct LowerName(_);

them should be through references. As a workaround the Strings are all Rc as well as the array

Methods

impl LowerName
[src]

Create a new domain::LowerName, i.e. label

Returns true if there are no labels, i.e. it's empty.

In DNS the root is represented by .

Examples

use trust_dns::rr::{LowerName, Name};

let root = LowerName::from(Name::root());
assert_eq!(&root.to_string(), ".");

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::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());

Trims off the first part of the name, to help with searching for the domain piece

Examples

use std::str::FromStr;
use trust_dns::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()));

returns true if the name components of self are all present at the end of name

Example

use std::str::FromStr;
use trust_dns::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));

Returns the number of labels in the name, discounting *.

Examples

use std::str::FromStr;
use trust_dns::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);

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.

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).

Trait Implementations

impl Default for LowerName
[src]

Returns the "default value" for a type. Read more

impl Debug for LowerName
[src]

Formats the value using the given formatter. Read more

impl Eq for LowerName
[src]

impl Clone for LowerName
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Hash for LowerName
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialEq<LowerName> for LowerName
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl BinEncodable for LowerName
[src]

Write the type to the stream

Returns the object in binary form

impl Display for LowerName
[src]

Formats the value using the given formatter. Read more

impl Index<usize> for LowerName
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl PartialOrd<LowerName> for LowerName
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for LowerName
[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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl From<Name> for LowerName
[src]

Performs the conversion.

impl<'a> From<&'a Name> for LowerName
[src]

Performs the conversion.

impl From<LowerName> for Name
[src]

Performs the conversion.

impl Borrow<Name> for LowerName
[src]

Immutably borrows from an owned value. Read more

impl<'r> BinDecodable<'r> for 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...

Returns the object in binary form

impl FromStr for LowerName
[src]

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Auto Trait Implementations

impl Send for LowerName

impl Sync for LowerName