[][src]Struct wdg_uri::authority::Host

pub struct Host<'a>(_);

Methods

impl<'a> Host<'a>[src]

pub fn new(data: &str) -> Host[src]

Create new Host.

Example:

use wdg_uri::authority::Host;
let host = Host::new("localhost");

pub fn validate(&self) -> bool[src]

Validate Host.

Support:

  • IPv4Address
  • IPv6Address

Example:

use wdg_uri::authority::Host;
let host = Host::new("127.0.0.1");
if !host.validate() {
    panic!("fail");
}

pub fn is_ipv4addr(&self) -> bool[src]

Check if Host is IPv4Address.

Example:

use wdg_uri::authority::Host;
let host = Host::new("127.0.0.1");
if host.is_ipv4addr() {
   println!("Host is IPv4Address.");
}

pub fn is_ipv6addr(&self) -> bool[src]

Check if Host is IPv6Address.

Example:

use wdg_uri::authority::Host;
let host = Host::new("::");
if host.is_ipv6addr() {
   println!("Host is IPv6Address.");
}

Trait Implementations

impl<'a> StringRepr for Host<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Host<'a>

impl<'a> Send for Host<'a>

impl<'a> Sync for Host<'a>

impl<'a> Unpin for Host<'a>

impl<'a> UnwindSafe for Host<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.