Struct rocket::http::hyper::header::Headers [−][src]
pub struct Headers { /* fields omitted */ }
Expand description
A map of header fields on requests and responses.
Implementations
impl Headers
[src]
impl Headers
[src]pub fn set<H>(&mut self, value: H) where
H: Header + HeaderFormat,
[src]
pub fn set<H>(&mut self, value: H) where
H: Header + HeaderFormat,
[src]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, Global>]>
[src]
pub fn get_raw(&self, name: &str) -> Option<&[Vec<u8, Global>]>
[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");
pub fn set_raw<K>(&mut self, name: K, value: Vec<Vec<u8, Global>, Global>) where
K: Into<Cow<'static, str>>,
[src]
pub fn set_raw<K>(&mut self, name: K, value: Vec<Vec<u8, Global>, Global>) where
K: Into<Cow<'static, str>>,
[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()]);
pub fn append_raw<K>(&mut self, name: K, value: Vec<u8, Global>) where
K: Into<Cow<'static, str>>,
[src]
pub fn append_raw<K>(&mut self, name: K, value: Vec<u8, Global>) where
K: Into<Cow<'static, str>>,
[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());
pub fn remove_raw(&mut self, name: &str)
[src]
pub fn remove_raw(&mut self, name: &str)
[src]Remove a header set by set_raw
pub fn get<H>(&self) -> Option<&H> where
H: Header + HeaderFormat,
[src]
pub fn get<H>(&self) -> Option<&H> where
H: Header + HeaderFormat,
[src]Get a reference to the header field’s value, if it exists.
pub fn get_mut<H>(&mut self) -> Option<&mut H> where
H: Header + HeaderFormat,
[src]
pub fn get_mut<H>(&mut self) -> Option<&mut H> where
H: Header + HeaderFormat,
[src]Get a mutable reference to the header field’s value, if it exists.
pub fn has<H>(&self) -> bool where
H: Header + HeaderFormat,
[src]
pub fn has<H>(&self) -> bool where
H: Header + HeaderFormat,
[src]Returns a boolean of whether a certain header is in the map.
Example:
let has_type = headers.has::<ContentType>();
pub fn remove<H>(&mut self) -> bool where
H: Header + HeaderFormat,
[src]
pub fn remove<H>(&mut self) -> bool where
H: Header + HeaderFormat,
[src]Removes a header from the map, if one existed. Returns true if a header has been removed.
pub fn iter(&self) -> HeadersItems<'_>
[src]
pub fn iter(&self) -> HeadersItems<'_>
[src]Returns an iterator over the header fields.
Trait Implementations
impl<'a> Extend<HeaderView<'a>> for Headers
[src]
impl<'a> Extend<HeaderView<'a>> for Headers
[src]pub fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = HeaderView<'a>>,
[src]
pub fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = HeaderView<'a>>,
[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, item: A)
[src]
fn extend_one(&mut self, item: A)
[src]extend_one
)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<'a> FromIterator<HeaderView<'a>> for Headers
[src]
impl<'a> FromIterator<HeaderView<'a>> for Headers
[src]pub fn from_iter<I>(iter: I) -> Headers where
I: IntoIterator<Item = HeaderView<'a>>,
[src]
pub fn from_iter<I>(iter: I) -> Headers where
I: IntoIterator<Item = HeaderView<'a>>,
[src]Creates a value from an iterator. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Headers
impl Send for Headers
impl !Sync for Headers
impl Unpin for Headers
impl !UnwindSafe for Headers
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.
pub fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 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<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,