Enum Host

pub enum Host<S = 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(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

impl Host<&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

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

https://url.spec.whatwg.org/#concept-opaque-host-parser

Trait Implementations

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

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

impl<S> Serialize for Host<S> where S: Serialize,

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

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

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

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

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

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

fn clone(&self) -> Self

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

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

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

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

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

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

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

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

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

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> UnsafeUnpin for Host<S> where S: UnsafeUnpin,

impl<S> UnwindSafe for Host<S> where S: UnwindSafe,

Blanket Implementations

impl<T> Any for Host<S> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Host<S> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Host<S> where T: ?Sized,

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

impl<T> CloneToUninit for Host<S> where T: Clone,

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

impl<T> DeserializeOwned for Host<S> where T: for<'de> Deserialize<'de>,

impl<T> From<T> for Host<S>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Host<S> where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> ToString for Host<S> where T: Display + ?Sized,

fn to_string(&self) -> String

impl<T, U> Into<U> for Host<S> where U: From<T>,

fn into(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<U> for Host<S> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Host<S> where U: TryFrom<T>,

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