[][src]Struct hyperx::header::Host

pub struct Host { /* fields omitted */ }

The Host header.

HTTP/1.1 requires that all requests include a Host header, and so hyper client requests add one automatically.

Examples

use hyperx::header::{Headers, Host};

let mut headers = Headers::new();
headers.set(
    Host::new("hyper.rs", None)
);
use hyperx::header::{Headers, Host};

let mut headers = Headers::new();
headers.set(
    // In Rust 1.12+
    // Host::new("hyper.rs", 8080)
    Host::new("hyper.rs", Some(8080))
);

Methods

impl Host[src]

pub fn new<H, P>(hostname: H, port: P) -> Host where
    H: Into<Cow<'static, str>>,
    P: Into<Option<u16>>, 
[src]

Create a Host header, providing the hostname and optional port.

pub fn hostname(&self) -> &str[src]

Get the hostname, such as example.domain.

pub fn port(&self) -> Option<u16>[src]

Get the optional port number.

Trait Implementations

impl StandardHeader for Host[src]

impl Header for Host[src]

impl Clone for Host[src]

impl PartialEq<Host> for Host[src]

impl Display for Host[src]

impl Debug for Host[src]

impl FromStr for Host[src]

type Err = Error

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Send for Host

impl Unpin for Host

impl Sync for Host

impl RefUnwindSafe for Host

impl UnwindSafe for Host

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for 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.

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

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

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