Enum Host

enum Host<S = alloc::string::String>

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(crate::net::Ipv4Addr)

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

Ipv6(crate::net::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

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

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

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

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

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

impl<'de, S> Deserialize for Host<S>

fn deserialize<__D>(__deserializer: __D) -> Result<Self, <__D as >::Error>
where
    __D: Deserializer<'de>

impl<S> Freeze for Host<S>

impl<S> RefUnwindSafe for Host<S>

impl<S> Send for Host<S>

impl<S> Serialize for Host<S>

fn serialize<__S>(self: &Self, __serializer: __S) -> Result<<__S as >::Ok, <__S as >::Error>
where
    __S: Serializer

impl<S> Sync for Host<S>

impl<S> Unpin for Host<S>

impl<S> UnsafeUnpin for Host<S>

impl<S> UnwindSafe for Host<S>

impl<S, T> PartialEq for Host<S>

fn eq(self: &Self, other: &Host<T>) -> bool

impl<S: $crate::clone::Clone> Clone for Host<S>

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

impl<S: $crate::cmp::Eq> Eq for Host<S>

impl<S: $crate::cmp::Ord> Ord for Host<S>

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

impl<S: $crate::cmp::PartialOrd> PartialOrd for Host<S>

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

impl<S: $crate::fmt::Debug> Debug for Host<S>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<S: $crate::hash::Hash> Hash for Host<S>

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

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

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T> Any for Host<S>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Host<S>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Host<S>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Host<S>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> DeserializeOwned for Host<S>

impl<T> ErasedDestructor for Host<S>

impl<T> From for Host<S>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Host<S>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> ToString for Host<S>

fn to_string(self: &Self) -> String

impl<T, U> Into for Host<S>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Host<S>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Host<S>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>