[][src]Trait typed_headers::Header

pub trait Header {
    fn name() -> &'static HeaderName;
fn from_values<'a>(
        values: &mut ValueIter<'a, HeaderValue>
    ) -> Result<Option<Self>, Error>
    where
        Self: Sized
;
fn to_values(&self, values: &mut ToValues); }

Required methods

fn name() -> &'static HeaderName

Returns the name of this header.

The http crate provides constants for all standard header names. Implementations for nonstandard headers can use the lazy_static crate to obtain a static reference to a HeaderName.

fn from_values<'a>(
    values: &mut ValueIter<'a, HeaderValue>
) -> Result<Option<Self>, Error> where
    Self: Sized

Parses the header from the raw value bytes.

The iterator may be empty, which indicates that the header was not present, and Ok(None) should be returned.

If the iterator is not exhausted when this function returns, it will be treated as a parse error.

fn to_values(&self, values: &mut ToValues)

Serializes the header to raw values.

Each call to values.append adds a header entry. Almost all headers should only append a single value. Set-Cookie is a rare exception.

This method is infallible. Header implementations should ensure at construction time that they will be able to successfully serialize.

Loading content...

Implementors

impl Header for RetryAfter[src]

impl Header for Accept[src]

impl Header for AcceptEncoding[src]

impl Header for Allow[src]

impl Header for Authorization[src]

impl Header for ContentEncoding[src]

impl Header for ContentLength[src]

impl Header for ContentType[src]

impl Header for Host[src]

impl Header for ProxyAuthorization[src]

Loading content...