Enum url::Host [] [src]

pub enum Host<S = String> {
    Domain(S),
    Ipv4(Ipv4Addr),
    Ipv6(Ipv6Addr),
}

The host name of an URL.

Variants

Domain

A DNS domain name, as '.' dot-separated labels. Non-ASCII labels are encoded in punycode per IDNA.

Ipv4

An IPv4 address. Url::host_str returns the serialization of this address, as four decimal integers separated by . dots.

Ipv6

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.

Methods

impl<'a> Host<&'a str>

fn to_owned(&self) -> Host<String>

Return a copy of self that owns an allocated String but does not borrow an &Url.

impl Host<String>

fn parse(input: &str) -> Result<Self, ParseError>

Parse a host: either an IPv6 address in [] square brackets, or a domain.

https://url.spec.whatwg.org/#host-parsing

Trait Implementations

impl<S: AsRef<str>> Display for Host<S>

fn fmt(&self, f: &mut Formatter) -> Result

Derived Implementations

impl<S: Hash> Hash for Host<S>

fn hash<__HS: Hasher>(&self, __arg_0: &mut __HS)

1.3.0fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl<S: PartialOrd> PartialOrd for Host<S>

fn partial_cmp(&self, __arg_0: &Host<S>) -> Option<Ordering>

fn lt(&self, __arg_0: &Host<S>) -> bool

fn le(&self, __arg_0: &Host<S>) -> bool

fn gt(&self, __arg_0: &Host<S>) -> bool

fn ge(&self, __arg_0: &Host<S>) -> bool

impl<S: Ord> Ord for Host<S>

fn cmp(&self, __arg_0: &Host<S>) -> Ordering

impl<S: PartialEq> PartialEq for Host<S>

fn eq(&self, __arg_0: &Host<S>) -> bool

fn ne(&self, __arg_0: &Host<S>) -> bool

impl<S: Eq> Eq for Host<S>

impl<S: Debug> Debug for Host<S>

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl<S: Clone> Clone for Host<S>

fn clone(&self) -> Host<S>

1.0.0fn clone_from(&mut self, source: &Self)