Struct typed_headers::Host [−][src]
pub struct Host { /* fields omitted */ }The Host header, defined in RFC7230.
The "Host" header field in a request provides the host and port information from the target URI, enabling the origin server to distinguish among resources while servicing requests for multiple host names on a single IP address.
ABNF
Host = uri-host [ ":" port ]
Methods
impl Host[src]
impl Hostpub fn new(host: &str, port: Option<u16>) -> Result<Host, Error>[src]
pub fn new(host: &str, port: Option<u16>) -> Result<Host, Error>Creates a Host header from a hostname and optional port.
Creates a Host header from a URI authority component.
The userinfo portion of the authority is not included in the header.
pub fn host(&self) -> &str[src]
pub fn host(&self) -> &strReturns the host.
pub fn port(&self) -> Option<u16>[src]
pub fn port(&self) -> Option<u16>Returns the port.
Trait Implementations
impl Debug for Host[src]
impl Debug for Hostfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Clone for Host[src]
impl Clone for Hostfn clone(&self) -> Host[src]
fn clone(&self) -> HostReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Header for Host[src]
impl Header for Hostfn name() -> &'static HeaderName[src]
fn name() -> &'static HeaderNameReturns the name of this header. Read more
fn from_values<'a>(
values: &mut ValueIter<'a, HeaderValue>
) -> Result<Option<Host>, Error>[src]
fn from_values<'a>(
values: &mut ValueIter<'a, HeaderValue>
) -> Result<Option<Host>, Error>Parses the header from the raw value bytes. Read more
fn to_values(&self, values: &mut ToValues)[src]
fn to_values(&self, values: &mut ToValues)Serializes the header to raw values. Read more