Struct hyper::header::Headers [] [src]

pub struct Headers {
    // some fields omitted
}

A map of header fields on requests and responses.

Methods

impl Headers
[src]

fn new() -> Headers

Creates a new, empty headers map.

fn set<H: Header + HeaderFormat>(&mut self, value: H)

Set a header field to the corresponding value.

The field is determined by the type of the value being set.

fn get_raw(&self, name: &str) -> Option<&[Vec<u8>]>

Access the raw value of a header.

Prefer to use the typed getters instead.

Example:

let raw_content_type = headers.get_raw("content-type");

fn set_raw<K: Into<Cow<'static, str>> + Debug>(&mut self, name: K, value: Vec<Vec<u8>>)

Set the raw value of a header, bypassing any typed headers.

Example:

headers.set_raw("content-length", vec![b"5".to_vec()]);

fn remove_raw(&mut self, name: &str)

Remove a header set by set_raw

fn get<H: Header + HeaderFormat>(&self) -> Option<&H>

Get a reference to the header field's value, if it exists.

fn get_mut<H: Header + HeaderFormat>(&mut self) -> Option<&mut H>

Get a mutable reference to the header field's value, if it exists.

fn has<H: Header + HeaderFormat>(&self) -> bool

Returns a boolean of whether a certain header is in the map.

Example:

let has_type = headers.has::<ContentType>();

fn remove<H: Header + HeaderFormat>(&mut self) -> bool

Removes a header from the map, if one existed. Returns true if a header has been removed.

fn iter(&self) -> HeadersItems

Returns an iterator over the header fields.

fn len(&self) -> usize

Returns the number of headers in the map.

fn clear(&mut self)

Remove all headers from the map.

Trait Implementations

impl Clone for Headers
[src]

fn clone(&self) -> Headers

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl PartialEq for Headers
[src]

fn eq(&self, other: &Headers) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.

impl Display for Headers
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Debug for Headers
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<'a> Extend<HeaderView<'a>> for Headers
[src]

fn extend<I: IntoIterator<Item=HeaderView<'a>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more

impl<'a> FromIterator<HeaderView<'a>> for Headers
[src]

fn from_iter<I: IntoIterator<Item=HeaderView<'a>>>(iter: I) -> Headers

Creates a value from an iterator. Read more