[−][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]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Host>
[src]
impl Header for Host
[src]
fn header_name() -> &'static str
[src]
fn parse_header(raw: &Raw) -> Result<Host>
[src]
fn fmt_header(&self, f: &mut Formatter) -> Result
[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,
fn borrow_mut(&mut self) -> &mut T
[src]
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,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,