pub enum Host<S = String> {
    Domain(S),
    Ipv4(Ipv4Addr),
    Ipv6(Ipv6Addr),
}Expand description
The host name of an URL.
Variants§
Domain(S)
A DNS domain name, as ‘.’ dot-separated labels. Non-ASCII labels are encoded in punycode per IDNA if this is the host of a special URL, or percent encoded for non-special URLs. Hosts for non-special URLs are also called opaque hosts.
Ipv4(Ipv4Addr)
An IPv4 address.
Url::host_str returns the serialization of this address,
as four decimal integers separated by . dots.
Ipv6(Ipv6Addr)
An IPv6 address.
Url::host_str returns the serialization of that address between [ and ] brackets,
in the format per RFC 5952 A Recommendation
for IPv6 Address Text Representation:
lowercase hexadecimal with maximal :: compression.
Implementations§
Source§impl Host
 
impl Host
Sourcepub fn parse(input: &str) -> Result<Host, ParseError>
 
pub fn parse(input: &str) -> Result<Host, ParseError>
Parse a host: either an IPv6 address in [] square brackets, or a domain.
pub fn parse_opaque(input: &str) -> Result<Host, ParseError>
Trait Implementations§
Source§impl<'de, S> Deserialize<'de> for Host<S>where
    S: Deserialize<'de>,
 
impl<'de, S> Deserialize<'de> for Host<S>where
    S: Deserialize<'de>,
Source§fn deserialize<__D>(
    __deserializer: __D,
) -> Result<Host<S>, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(
    __deserializer: __D,
) -> Result<Host<S>, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<S> Ord for Host<S>where
    S: Ord,
 
impl<S> Ord for Host<S>where
    S: Ord,
Source§impl<S> PartialOrd for Host<S>where
    S: PartialOrd,
 
impl<S> PartialOrd for Host<S>where
    S: PartialOrd,
Source§impl<S> Serialize for Host<S>where
    S: Serialize,
 
impl<S> Serialize for Host<S>where
    S: Serialize,
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<S> Eq for Host<S>where
    S: Eq,
Auto Trait Implementations§
impl<S> Freeze for Host<S>where
    S: Freeze,
impl<S> RefUnwindSafe for Host<S>where
    S: RefUnwindSafe,
impl<S> Send for Host<S>where
    S: Send,
impl<S> Sync for Host<S>where
    S: Sync,
impl<S> Unpin for Host<S>where
    S: Unpin,
impl<S> UnwindSafe for Host<S>where
    S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<Q, K> Comparable<K> for Q
 
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
Compare self to 
key and return true if they are equal.