trust_dns_proto::rr::domain::usage

Struct IP6_ARPA_FE_8

Source
pub struct IP6_ARPA_FE_8 { /* private fields */ }
Expand description

254.169.in-addr.arpa. usage link-local, i.e. mDNS

Methods from Deref<Target = ZoneUsage>§

Source

pub fn name(&self) -> &Name

A reference to this zone name

Source

pub fn user(&self) -> UserUsage

Returns the UserUsage of this zone

Source

pub fn app(&self) -> AppUsage

Returns the AppUsage of this zone

Source

pub fn resolver(&self) -> ResolverUsage

Returns the ResolverUsage of this zone

Source

pub fn cache(&self) -> CacheUsage

Returns the CacheUsage of this zone

Source

pub fn auth(&self) -> AuthUsage

Returns the AuthUsage of this zone

Source

pub fn op(&self) -> OpUsage

Returns the OpUsage of this zone

Source

pub fn registry(&self) -> RegistryUsage

Returns the RegistryUsage of this zone

Methods from Deref<Target = Name>§

Source

pub fn is_root(&self) -> bool

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

In DNS the root is represented by .

§Examples
use trust_dns_proto::rr::domain::Name;

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

pub fn is_fqdn(&self) -> bool

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_proto::rr::domain::Name;

let name = Name::from_str("www").unwrap();
assert!(!name.is_fqdn());

let name = Name::from_str("www.example.com").unwrap();
assert!(!name.is_fqdn());

let name = Name::from_str("www.example.com.").unwrap();
assert!(name.is_fqdn());
Source

pub fn iter(&self) -> LabelIter<'_>

Returns an iterator over the labels

Source

pub fn to_lowercase(&self) -> Self

Creates a new Name with all labels lowercased

§Examples
use std::cmp::Ordering;
use std::str::FromStr;

use trust_dns_proto::rr::domain::{Label, Name};

let example_com = Name::from_ascii("Example.Com").unwrap();
assert_eq!(example_com.cmp_case(&Name::from_str("example.com").unwrap()), Ordering::Less);
assert!(example_com.to_lowercase().eq_case(&Name::from_str("example.com").unwrap()));
Source

pub fn base_name(&self) -> Self

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

§Examples
use std::str::FromStr;
use trust_dns_proto::rr::domain::Name;

let example_com = Name::from_str("example.com.").unwrap();
assert_eq!(example_com.base_name(), Name::from_str("com.").unwrap());
assert_eq!(Name::from_str("com.").unwrap().base_name(), Name::root());
assert_eq!(Name::root().base_name(), Name::root());
Source

pub fn trim_to(&self, num_labels: usize) -> Self

Trims to the number of labels specified

§Examples
use std::str::FromStr;
use trust_dns_proto::rr::domain::Name;

let example_com = Name::from_str("example.com.").unwrap();
assert_eq!(example_com.trim_to(2), Name::from_str("example.com.").unwrap());
assert_eq!(example_com.trim_to(1), Name::from_str("com.").unwrap());
assert_eq!(example_com.trim_to(0), Name::root());
assert_eq!(example_com.trim_to(3), Name::from_str("example.com.").unwrap());
Source

pub fn zone_of_case(&self, name: &Self) -> bool

same as zone_of allows for case sensitive call

Source

pub fn zone_of(&self, name: &Self) -> bool

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

§Example
use std::str::FromStr;
use trust_dns_proto::rr::domain::Name;

let name = Name::from_str("www.example.com").unwrap();
let name = Name::from_str("www.example.com").unwrap();
let zone = Name::from_str("example.com").unwrap();
let another = Name::from_str("example.net").unwrap();
assert!(zone.zone_of(&name));
assert!(!name.zone_of(&zone));
assert!(!another.zone_of(&name));
Source

pub fn num_labels(&self) -> u8

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

§Examples
use std::str::FromStr;
use trust_dns_proto::rr::domain::Name;

let root = Name::root();
assert_eq!(root.num_labels(), 0);

let example_com = Name::from_str("example.com").unwrap();
assert_eq!(example_com.num_labels(), 2);

let star_example_com = Name::from_str("*.example.com.").unwrap();
assert_eq!(star_example_com.num_labels(), 2);
Source

pub fn len(&self) -> usize

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.

§Examples
use std::str::FromStr;
use trust_dns_proto::rr::domain::Name;

assert_eq!(Name::from_str("www.example.com.").unwrap().len(), 16);
assert_eq!(Name::from_str(".").unwrap().len(), 1);
assert_eq!(Name::root().len(), 1);
Source

pub fn is_empty(&self) -> bool

Returns whether the length of the labels, in bytes is 0. In practice, since ‘.’ counts as 1, this is never the case so the method returns false.

Source

pub fn emit_as_canonical( &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).

Source

pub fn emit_with_lowercase( &self, encoder: &mut BinEncoder<'_>, lowercase: bool, ) -> ProtoResult<()>

Writes the labels, as lower case, to the encoder

§Arguments
  • encoder - encoder for writing this name
  • lowercase - if true the name will be lowercased, otherwise it will not be changed when writing
Source

pub fn cmp_case(&self, other: &Self) -> Ordering

Case sensitive comparison

Source

pub fn eq_case(&self, other: &Self) -> bool

Compares the Names, in a case sensitive manner

Source

pub fn to_ascii(&self) -> String

Converts this name into an ascii safe string.

If the name is an IDNA name, then the name labels will be returned with the xn-- prefix. see to_utf8 or the Display impl for methods which convert labels to utf8.

Source

pub fn to_utf8(&self) -> String

Converts the Name labels to the utf8 String form.

This converts the name to an unescaped format, that could be used with parse. If, the name is is followed by the final ., e.g. as in www.example.com., which represents a fully qualified Name.

Source

pub fn parse_arpa_name(&self) -> Result<IpNet, ProtoError>

Converts a *.arpa Name in a PTR record back into an IpNet if possible.

Source

pub fn is_localhost(&self) -> bool

Returns true if the Name is either localhost or in the localhost zone.

§Example
use std::str::FromStr;
use trust_dns_proto::rr::Name;

let name = Name::from_str("localhost").unwrap();
assert!(name.is_localhost());

let name = Name::from_str("localhost.").unwrap();
assert!(name.is_localhost());

let name = Name::from_str("my.localhost.").unwrap();
assert!(name.is_localhost());
Source

pub fn is_wildcard(&self) -> bool

True if the first label of this name is the wildcard, i.e. ‘*’

§Example
use std::str::FromStr;
use trust_dns_proto::rr::Name;

let name = Name::from_str("www.example.com").unwrap();
assert!(!name.is_wildcard());

let name = Name::from_str("*.example.com").unwrap();
assert!(name.is_wildcard());

let name = Name::root();
assert!(!name.is_wildcard());

Trait Implementations§

Source§

impl Deref for IP6_ARPA_FE_8

Source§

type Target = ZoneUsage

The resulting type after dereferencing.
Source§

fn deref(&self) -> &ZoneUsage

Dereferences the value.
Source§

impl LazyStatic for IP6_ARPA_FE_8

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more