[−][src]Struct hyper::header::Host
The Host
header.
HTTP/1.1 requires that all requests include a Host
header, and so hyper
client requests add one automatically.
Examples
use hyper::header::{Headers, Host}; let mut headers = Headers::new(); headers.set( Host::new("hyper.rs", None) );
use hyper::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][−]
H: Into<Cow<'static, str>>,
P: Into<Option<u16>>,
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 Clone for Host
[src][+]
impl Debug for Host
[src][+]
impl Display for Host
[src][+]
impl FromStr for Host
[src][+]
impl Header for Host
[src][+]
impl PartialEq<Host> for Host
[src][+]
impl StructuralPartialEq for Host
[src]
Auto Trait Implementations
impl RefUnwindSafe for Host
impl Send for Host
impl Sync for Host
impl Unpin for Host
impl UnwindSafe for Host
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src][+]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,