pub struct DnsName<'a>(/* private fields */);Expand description
A type which encapsulates a string (borrowed or owned) that is a syntactically valid DNS name.
A single trailing dot is accepted when parsing, but is removed: example.com.
parses to a DnsName that is identical to one parsed from example.com.
RFC 6066 section 3
specifies that the name sent in the TLS Server Name Indication extension
is “without a trailing dot”, so as_ref() always gives a name suitable for
that. Callers who must treat absolute names differently need to inspect
the input before parsing.
Equality and hashing ignore ASCII case: example.com and Example.COM are equal.
Implementations§
Source§impl<'a> DnsName<'a>
impl<'a> DnsName<'a>
Sourcepub fn to_lowercase_owned(&self) -> DnsName<'static>
pub fn to_lowercase_owned(&self) -> DnsName<'static>
Copy this object to produce an owned DnsName, smashing the case to lowercase
in one operation.
Sourcepub fn to_owned(&self) -> DnsName<'static>
pub fn to_owned(&self) -> DnsName<'static>
Copy an owned DnsName from this (potentially borrowed) DnsName.
Sourcepub fn into_owned(self) -> DnsName<'static>
pub fn into_owned(self) -> DnsName<'static>
Produce an owned DnsName from this (potentially borrowed) DnsName.
Sourcepub const fn try_from_str(s: &str) -> Result<DnsName<'_>, InvalidDnsNameError>
pub const fn try_from_str(s: &str) -> Result<DnsName<'_>, InvalidDnsNameError>
Produces a borrowed DnsName from a borrowed [str].