[−][src]Struct hyper::header::Headers
A map of header fields on requests and responses.
Methods
impl Headers
[src]
impl Headers
pub fn new() -> Headers
[src]
pub fn new() -> Headers
Creates a new, empty headers map.
pub fn set<H: Header + HeaderFormat>(&mut self, value: H)
[src]
pub 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.
pub fn get_raw(&self, name: &str) -> Option<&[Vec<u8>]>
[src]
pub 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");
pub fn set_raw<K: Into<Cow<'static, str>>>(
&mut self,
name: K,
value: Vec<Vec<u8>>
)
[src]
pub fn set_raw<K: Into<Cow<'static, str>>>(
&mut self,
name: K,
value: Vec<Vec<u8>>
)
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()]);
pub fn append_raw<K: Into<Cow<'static, str>>>(
&mut self,
name: K,
value: Vec<u8>
)
[src]
pub fn append_raw<K: Into<Cow<'static, str>>>(
&mut self,
name: K,
value: Vec<u8>
)
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());
pub fn remove_raw(&mut self, name: &str)
[src]
pub fn remove_raw(&mut self, name: &str)
Remove a header set by set_raw
pub fn get<H: Header + HeaderFormat>(&self) -> Option<&H>
[src]
pub fn get<H: Header + HeaderFormat>(&self) -> Option<&H>
Get a reference to the header field's value, if it exists.
pub fn get_mut<H: Header + HeaderFormat>(&mut self) -> Option<&mut H>
[src]
pub fn get_mut<H: Header + HeaderFormat>(&mut self) -> Option<&mut H>
Get a mutable reference to the header field's value, if it exists.
pub fn has<H: Header + HeaderFormat>(&self) -> bool
[src]
pub 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>();
pub fn remove<H: Header + HeaderFormat>(&mut self) -> bool
[src]
pub 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.
ⓘImportant traits for HeadersItems<'a>pub fn iter(&self) -> HeadersItems
[src]
pub fn iter(&self) -> HeadersItems
Returns an iterator over the header fields.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of headers in the map.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Remove all headers from the map.
Trait Implementations
impl PartialEq<Headers> for Headers
[src]
impl PartialEq<Headers> for Headers
fn eq(&self, other: &Headers) -> bool
[src]
fn eq(&self, other: &Headers) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Clone for Headers
[src]
impl Clone for Headers
fn clone(&self) -> Headers
[src]
fn clone(&self) -> Headers
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a> Extend<HeaderView<'a>> for Headers
[src]
impl<'a> Extend<HeaderView<'a>> for Headers
fn extend<I: IntoIterator<Item = HeaderView<'a>>>(&mut self, iter: I)
[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]
impl<'a> FromIterator<HeaderView<'a>> for Headers
fn from_iter<I: IntoIterator<Item = HeaderView<'a>>>(iter: I) -> Headers
[src]
fn from_iter<I: IntoIterator<Item = HeaderView<'a>>>(iter: I) -> Headers
Creates a value from an iterator. Read more
impl Debug for Headers
[src]
impl Debug for Headers
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for Headers
[src]
impl Display for Headers
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Typeable for T where
T: Any,
[src]
impl<T> Typeable for T where
T: Any,