pub struct DomainName(/* private fields */);Expand description
A syntactically valid, canonical DNS name.
Equality, ordering, hashing, and serialization use the lowercase ASCII
A-label form. Construction is only possible through DomainName::parse.
Implementations§
Source§impl DomainName
impl DomainName
Sourcepub fn parse(input: &str) -> Result<DomainName, DomainNameError>
pub fn parse(input: &str) -> Result<DomainName, DomainNameError>
Parses a domain using strict IDNA processing and DNS host-label rules.
One terminal root dot is accepted and removed. Leading/trailing whitespace is rejected rather than silently changing user input.
§Errors
Returns a stable DomainNameError when IDNA processing or DNS label
validation rejects the input.
Sourcepub fn to_unicode(&self) -> String
pub fn to_unicode(&self) -> String
Returns the normalized Unicode display form.
Sourcepub fn identity(&self) -> DomainIdentity
pub fn identity(&self) -> DomainIdentity
Resolves the embedded Public Suffix List boundary.
A missing boundary means policy coverage is unknown, not that the name is invalid or available.
Trait Implementations§
Source§impl Clone for DomainName
impl Clone for DomainName
Source§fn clone(&self) -> DomainName
fn clone(&self) -> DomainName
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DomainName
impl Debug for DomainName
Source§impl<'de> Deserialize<'de> for DomainName
impl<'de> Deserialize<'de> for DomainName
Source§fn deserialize<D>(
deserializer: D,
) -> Result<DomainName, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<DomainName, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for DomainName
impl Display for DomainName
impl Eq for DomainName
Source§impl Hash for DomainName
impl Hash for DomainName
Source§impl Ord for DomainName
impl Ord for DomainName
Source§fn cmp(&self, other: &DomainName) -> Ordering
fn cmp(&self, other: &DomainName) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for DomainName
impl PartialEq for DomainName
Source§impl PartialOrd for DomainName
impl PartialOrd for DomainName
Source§impl Serialize for DomainName
impl Serialize for DomainName
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for DomainName
Auto Trait Implementations§
impl Freeze for DomainName
impl RefUnwindSafe for DomainName
impl Send for DomainName
impl Sync for DomainName
impl Unpin for DomainName
impl UnsafeUnpin for DomainName
impl UnwindSafe for DomainName
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more