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

pub struct Headers { /* fields omitted */ }

A map of header fields on requests and responses.

Methods

impl Headers
[src]

Creates a new, empty headers map.

Set a header field to the corresponding value.

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

Access the raw value of a header.

Prefer to use the typed getters instead.

Example:

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

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()]);

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());

Remove a header set by set_raw

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

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

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

Example:

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

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

Returns an iterator over the header fields.

Returns the number of headers in the map.

Remove all headers from the map.

Trait Implementations

impl PartialEq<Headers> for Headers
[src]

This method tests for !=.

impl Clone for Headers
[src]

Performs copy-assignment from source. Read more

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

impl Display for Headers
[src]

impl Debug for Headers
[src]

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

Auto Trait Implementations

impl Send for Headers

impl !Sync for Headers

Blanket Implementations

impl<T> From for T
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Typeable for T where
    T: Any

Get the TypeId of this object.

impl<T> IntoCollection for T

impl<T, I> AsResult for T where
    I: Input,