Struct hyper::header::HeadersExperimental
[-]
[+]
[src]
pub struct Headers { // some fields omitted }
A map of header fields on requests and responses.
Methods
impl Headers
fn new() -> Headers
Creates a new, empty headers map.
fn set<H: Header>(&mut self, value: H)
Set a header field to the corresponding value.
The field is determined by the type of the value being set.
unsafe fn get_raw(&self, name: &'static str) -> Option<*const [Vec<u8>]>
Access the raw value of a header, if it exists and has not been already parsed.
If the header field has already been parsed into a typed header, then you must access it through that representation.
This operation is unsafe because the raw representation can be invalidated by lasting too long or by the header being parsed while you still have a reference to the data.
Example: ```
use hyper::header::Headers;
let mut headers = Headers::new();
let raw_content_type = unsafe { headers.get_raw("content-type") }; ```
fn get<H: Header>(&self) -> Option<&H>
Get a reference to the header field's value, if it exists.
fn get_mut<H: Header>(&mut self) -> Option<&mut H>
Get a mutable reference to the header field's value, if it exists.
fn has<H: Header>(&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>(&mut self) -> bool
Removes a header from the map, if one existed. Returns true if a header has been removed.
fn iter<'a>(&'a self) -> HeadersItems<'a>
Returns an iterator over the header fields.