[−][src]Struct hyperx::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 hyperx::header::{Host, TypedHeaders}; let mut headers = http::HeaderMap::new(); headers.encode( &Host::new("hyper.rs", None) );
use hyperx::header::{Host, TypedHeaders}; let mut headers = http::HeaderMap::new(); headers.encode( &Host::new("hyper.rs", 8080) );
Implementations
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.
pub fn from_str(s: &str) -> Result<Host>
[src]
impl Header for Host
[src]
pub fn header_name() -> &'static str
[src]
pub fn parse_header<'a, T>(raw: &'a T) -> Result<Host> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
pub fn fmt_header(&self, f: &mut Formatter<'_, '_>) -> Result
[src]
impl PartialEq<Host> for Host
[src]
impl StandardHeader for Host
[src]
pub fn http_header_name() -> HeaderName
[src]
impl StructuralPartialEq for Host
[src]
Auto Trait Implementations
impl RefUnwindSafe for Host
[src]
impl Send for Host
[src]
impl Sync for Host
[src]
impl Unpin for Host
[src]
impl UnwindSafe for Host
[src]
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,