Struct trust_dns_proto::rr::domain::usage::ZoneUsage [−][src]
pub struct ZoneUsage { /* fields omitted */ }ZoneUsage represents information about how a name falling in a given zone should be treated
Methods
impl ZoneUsage[src]
impl ZoneUsagepub fn new(
name: Name,
user: UserUsage,
app: AppUsage,
resolver: ResolverUsage,
cache: CacheUsage,
auth: AuthUsage,
op: OpUsage,
registry: RegistryUsage
) -> Self[src]
pub fn new(
name: Name,
user: UserUsage,
app: AppUsage,
resolver: ResolverUsage,
cache: CacheUsage,
auth: AuthUsage,
op: OpUsage,
registry: RegistryUsage
) -> SelfConstructs a new ZoneUsage with the associated values
pub fn default() -> Self[src]
pub fn default() -> SelfConstructs a new Default, with all no restrictions
pub fn reverse(name: Name) -> Self[src]
pub fn reverse(name: Name) -> SelfRestrictions for reverse zones
pub fn test(name: Name) -> Self[src]
pub fn test(name: Name) -> SelfRestrictions for the .test. zone
pub fn localhost(name: Name) -> Self[src]
pub fn localhost(name: Name) -> SelfRestrictions for the .localhost. zone
pub fn local(name: Name) -> Self[src]
pub fn local(name: Name) -> SelfRestrictions for the .local. zone
pub fn invalid(name: Name) -> Self[src]
pub fn invalid(name: Name) -> SelfRestrictions for the .invalid. zone
pub fn example(name: Name) -> Self[src]
pub fn example(name: Name) -> SelfRestrictions for the .example. zone
pub fn name(&self) -> &Name[src]
pub fn name(&self) -> &NameA reference to this zone name
pub fn user(&self) -> UserUsage[src]
pub fn user(&self) -> UserUsageReturnes the UserUsage of this zone
pub fn app(&self) -> AppUsage[src]
pub fn app(&self) -> AppUsageReturnes the AppUsage of this zone
pub fn resolver(&self) -> ResolverUsage[src]
pub fn resolver(&self) -> ResolverUsageReturnes the ResolverUsage of this zone
pub fn cache(&self) -> CacheUsage[src]
pub fn cache(&self) -> CacheUsageReturnes the CacheUsage of this zone
pub fn auth(&self) -> AuthUsage[src]
pub fn auth(&self) -> AuthUsageReturnes the AuthUsage of this zone
pub fn op(&self) -> OpUsage[src]
pub fn op(&self) -> OpUsageReturnes the OpUsage of this zone
pub fn registry(&self) -> RegistryUsage[src]
pub fn registry(&self) -> RegistryUsageReturnes the RegistryUsage of this zone
Methods from Deref<Target = Name>
pub fn is_root(&self) -> bool[src]
pub fn is_root(&self) -> boolReturns 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(), ".");
pub fn is_fqdn(&self) -> bool[src]
pub fn is_fqdn(&self) -> boolReturns 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());
pub fn iter(&self) -> LabelIter[src]
pub fn iter(&self) -> LabelIterReturns an iterator over the labels
pub fn to_lowercase(&self) -> Self[src]
pub fn to_lowercase(&self) -> SelfCreates 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()));
pub fn base_name(&self) -> Name[src]
pub fn base_name(&self) -> NameTrims 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());
pub fn trim_to(&self, num_labels: usize) -> Name[src]
pub fn trim_to(&self, num_labels: usize) -> NameTrims 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());
pub fn zone_of_case(&self, name: &Self) -> bool[src]
pub fn zone_of_case(&self, name: &Self) -> boolsame as zone_of allows for case sensitive call
pub fn zone_of(&self, name: &Self) -> bool[src]
pub fn zone_of(&self, name: &Self) -> boolreturns 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));
pub fn num_labels(&self) -> u8[src]
pub fn num_labels(&self) -> u8Returns 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);
pub fn len(&self) -> usize[src]
pub fn len(&self) -> usizereturns 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);
pub fn is_empty(&self) -> bool[src]
pub fn is_empty(&self) -> boolReturns whether the length of the labels, in bytes is 0. In practive, since '.' counts as 1, this is never the case so the method returns false.
pub fn emit_as_canonical(
&self,
encoder: &mut BinEncoder,
canonical: bool
) -> ProtoResult<()>[src]
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).
pub fn emit_with_lowercase(
&self,
encoder: &mut BinEncoder,
lowercase: bool
) -> ProtoResult<()>[src]
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 namelowercase- if true the name will be lowercased, otherwise it will not be changed when writing
pub fn cmp_case(&self, other: &Self) -> Ordering[src]
pub fn cmp_case(&self, other: &Self) -> OrderingCase sensitive comparison
pub fn eq_case(&self, other: &Self) -> bool[src]
pub fn eq_case(&self, other: &Self) -> boolCompares the Names, in a case sensitive manner
pub fn to_ascii(&self) -> String[src]
pub fn to_ascii(&self) -> StringConverts 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.
pub fn to_utf8(&self) -> String[src]
pub fn to_utf8(&self) -> StringConverts 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.
pub fn is_localhost(&self) -> bool[src]
pub fn is_localhost(&self) -> boolReturns 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());