pub struct DomainRef<'a> { /* private fields */ }Expand description
A Domain reference.
Implementations§
Source§impl<'a> DomainRef<'a>
Conversions
impl<'a> DomainRef<'a>
Conversions
Sourcepub fn to_endpoint(self, port: u16) -> Endpoint
pub fn to_endpoint(self, port: u16) -> Endpoint
Converts the domain reference to an endpoint with the port.
Sourcepub const fn to_endpoint_ref(self, port: u16) -> EndpointRef<'a>
pub const fn to_endpoint_ref(self, port: u16) -> EndpointRef<'a>
Converts the domain reference to an endpoint reference with the port.
Sourcepub const fn to_host_ref(self) -> HostRef<'a>
pub const fn to_host_ref(self) -> HostRef<'a>
Converts the domain reference to a host reference.
Source§impl<'a> DomainRef<'a>
Parse
impl<'a> DomainRef<'a>
Parse
Sourcepub fn parse_text(text: &'a [u8]) -> Result<Self, ParseError>
pub fn parse_text(text: &'a [u8]) -> Result<Self, ParseError>
Dot-separated labels of ASCII letters, digits, & dashes. (see Domain::is_valid_name)
The name must already be in lowercase. Use Domain to parse mixed-case input.
Source§impl<'a> DomainRef<'a>
International Domain Names
impl<'a> DomainRef<'a>
International Domain Names
Sourcepub fn to_unicode(self) -> Result<String, ParseError>
Available on crate feature idna only.
pub fn to_unicode(self) -> Result<String, ParseError>
idna only.Converts the domain name to its Unicode representation.
Returns an error if a label contains invalid punycode. (example: xn--a.example)
Trait Implementations§
impl<'a> Copy for DomainRef<'a>
Source§impl<'de: 'a, 'a> Deserialize<'de> for DomainRef<'a>
Available on crate feature serde only.
impl<'de: 'a, 'a> Deserialize<'de> for DomainRef<'a>
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
The string is borrowed from the input, so domain names must be lowercase and must not contain escape sequences. Use Domain to deserialize mixed-case or escaped input.
impl<'a> Eq for DomainRef<'a>
Source§impl<'a> Ord for DomainRef<'a>
impl<'a> Ord for DomainRef<'a>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'a> PartialOrd for DomainRef<'a>
impl<'a> PartialOrd for DomainRef<'a>
impl<'a> StructuralPartialEq for DomainRef<'a>
Source§impl<'a> TryFrom<&'a str> for DomainRef<'a>
impl<'a> TryFrom<&'a str> for DomainRef<'a>
Source§fn try_from(text: &'a str) -> Result<Self, Self::Error>
fn try_from(text: &'a str) -> Result<Self, Self::Error>
Dot-separated labels of ASCII letters, digits, & dashes. (see Domain::is_valid_name)
The name must already be in lowercase. Use Domain to parse mixed-case input.