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

pub struct Headers { /* fields omitted */ }

A map of header fields on requests and responses.

Methods

impl Headers
[src]

[src]

Creates a new, empty headers map.

[src]

Set a header field to the corresponding value.

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

[src]

Access the raw value of a header.

Prefer to use the typed getters instead.

Example:

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

[src]

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

Note: This will completely replace any current value for this header name.

Example:

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

[src]

Append a value to raw value of this header.

If a header already contains a value, this will add another line to it.

If a header doesnot exist for this name, a new one will be created with the value.

Example:

headers.append_raw("x-foo", b"bar".to_vec());
headers.append_raw("x-foo", b"quux".to_vec());

[src]

Remove a header set by set_raw

[src]

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

[src]

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

[src]

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

Example:

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

[src]

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

Important traits for HeadersItems<'a>
[src]

Returns an iterator over the header fields.

[src]

Returns the number of headers in the map.

[src]

Remove all headers from the map.

Trait Implementations

impl Clone for Headers
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq for Headers
[src]

[src]

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

1.0.0
[src]

This method tests for !=.

impl Display for Headers
[src]

[src]

Formats the value using the given formatter. Read more

impl Debug for Headers
[src]

[src]

Formats the value using the given formatter. Read more

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

[src]

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

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

[src]

Creates a value from an iterator. Read more