Trait hyper::header::HeaderExperimental
[-]
[+]
[src]
pub trait Header: Typeable + Send + Sync { fn header_name(marker: Option<Self>) -> &'static str; fn parse_header(raw: &[Vec<u8>]) -> Option<Self>; fn fmt_header(&self, fmt: &mut Formatter) -> Result; }
A trait for any object that will represent a header field and value.
Required Methods
fn header_name(marker: Option<Self>) -> &'static str
Returns the name of the header field this belongs to.
The market Option
is to hint to the type system which implementation
to call. This can be done away with once UFCS arrives.
fn parse_header(raw: &[Vec<u8>]) -> Option<Self>
Parse a header from a raw stream of bytes.
It's possible that a request can include a header field more than once,
and in that case, the slice will have a length greater than 1. However,
it's not necessarily the case that a Header is allowed to have more
than one field value. If that's the case, you should return None
if raw.len() > 1
.
fn fmt_header(&self, fmt: &mut Formatter) -> Result
Format a header to be output into a TcpStream.
Implementors
impl Header for Host
impl Header for ContentLength
impl Header for ContentType
impl Header for Accept
impl Header for Connection
impl Header for TransferEncoding
impl Header for UserAgent
impl Header for Server
impl Header for Date
impl Header for Location