Struct http_types::Trailers [−][src]
pub struct Trailers { /* fields omitted */ }
A collection of trailing HTTP headers.
Implementations
impl Trailers
[src]
impl Trailers
[src]pub fn new() -> Self
[src]
Create a new instance of Trailers
.
pub fn insert(
&mut self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
) -> Option<HeaderValues>
[src]
&mut self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
) -> Option<HeaderValues>
Insert a header into the headers.
Examples
use http_types::Trailers; let mut trailers = Trailers::new(); trailers.insert("Content-Type", "text/plain");
pub fn append(
&mut self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
)
[src]
&mut self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
)
Append a header to the headers.
Unlike insert
this function will not override the contents of a header, but insert a
header if there aren’t any. Or else append to the existing list of headers.
Examples
use http_types::Trailers; let mut trailers = Trailers::new(); trailers.append("Content-Type", "text/plain");
pub fn get(&self, name: impl Into<HeaderName>) -> Option<&HeaderValues>
[src]
Get a reference to a header.
pub fn get_mut(
&mut self,
name: impl Into<HeaderName>
) -> Option<&mut HeaderValues>
[src]
&mut self,
name: impl Into<HeaderName>
) -> Option<&mut HeaderValues>
Get a mutable reference to a header.
pub fn remove(&mut self, name: impl Into<HeaderName>) -> Option<HeaderValues>
[src]
Remove a header.
pub fn iter(&self) -> Iter<'_>ⓘNotable traits for Iter<'a>
impl<'a> Iterator for Iter<'a> type Item = (&'a HeaderName, &'a HeaderValues);
[src]
Notable traits for Iter<'a>
impl<'a> Iterator for Iter<'a> type Item = (&'a HeaderName, &'a HeaderValues);
An iterator visiting all header pairs in arbitrary order.
pub fn iter_mut(&mut self) -> IterMut<'_>ⓘNotable traits for IterMut<'a>
impl<'a> Iterator for IterMut<'a> type Item = (&'a HeaderName, &'a mut HeaderValues);
[src]
Notable traits for IterMut<'a>
impl<'a> Iterator for IterMut<'a> type Item = (&'a HeaderName, &'a mut HeaderValues);
An iterator visiting all header pairs in arbitrary order, with mutable references to the values.
pub fn names(&self) -> Names<'_>ⓘNotable traits for Names<'a>
impl<'a> Iterator for Names<'a> type Item = &'a HeaderName;
[src]
Notable traits for Names<'a>
impl<'a> Iterator for Names<'a> type Item = &'a HeaderName;
An iterator visiting all header names in arbitrary order.
pub fn values(&self) -> Values<'_>ⓘNotable traits for Values<'a>
impl<'a> Iterator for Values<'a> type Item = &'a HeaderValue;
[src]
Notable traits for Values<'a>
impl<'a> Iterator for Values<'a> type Item = &'a HeaderValue;
An iterator visiting all header values in arbitrary order.
Methods from Deref<Target = Headers>
pub fn insert(
&mut self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
) -> Option<HeaderValues>
[src]
&mut self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
) -> Option<HeaderValues>
Insert a header into the headers.
Not that this will replace all header values for a given header name.
If you wish to add header values for a header name that already exists
use Headers::append
pub fn append(
&mut self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
)
[src]
&mut self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
)
Append a header to the headers.
Unlike insert
this function will not override the contents of a header, but insert a
header if there aren’t any. Or else append to the existing list of headers.
pub fn get(&self, name: impl Into<HeaderName>) -> Option<&HeaderValues>
[src]
Get a reference to a header.
pub fn get_mut(
&mut self,
name: impl Into<HeaderName>
) -> Option<&mut HeaderValues>
[src]
&mut self,
name: impl Into<HeaderName>
) -> Option<&mut HeaderValues>
Get a mutable reference to a header.
pub fn remove(&mut self, name: impl Into<HeaderName>) -> Option<HeaderValues>
[src]
Remove a header.
pub fn iter(&self) -> Iter<'_>ⓘNotable traits for Iter<'a>
impl<'a> Iterator for Iter<'a> type Item = (&'a HeaderName, &'a HeaderValues);
[src]
Notable traits for Iter<'a>
impl<'a> Iterator for Iter<'a> type Item = (&'a HeaderName, &'a HeaderValues);
An iterator visiting all header pairs in arbitrary order.
pub fn iter_mut(&mut self) -> IterMut<'_>ⓘNotable traits for IterMut<'a>
impl<'a> Iterator for IterMut<'a> type Item = (&'a HeaderName, &'a mut HeaderValues);
[src]
Notable traits for IterMut<'a>
impl<'a> Iterator for IterMut<'a> type Item = (&'a HeaderName, &'a mut HeaderValues);
An iterator visiting all header pairs in arbitrary order, with mutable references to the values.
pub fn names(&self) -> Names<'_>ⓘNotable traits for Names<'a>
impl<'a> Iterator for Names<'a> type Item = &'a HeaderName;
[src]
Notable traits for Names<'a>
impl<'a> Iterator for Names<'a> type Item = &'a HeaderName;
An iterator visiting all header names in arbitrary order.
pub fn values(&self) -> Values<'_>ⓘNotable traits for Values<'a>
impl<'a> Iterator for Values<'a> type Item = &'a HeaderValue;
[src]
Notable traits for Values<'a>
impl<'a> Iterator for Values<'a> type Item = &'a HeaderValue;
An iterator visiting all header values in arbitrary order.
Trait Implementations
impl Clone for Trailers
[src]
impl Clone for Trailers
[src]fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Index<&'_ str> for Trailers
[src]
impl Index<&'_ str> for Trailers
[src]type Output = HeaderValues
The returned type after indexing.
fn index(&self, name: &str) -> &HeaderValues
[src]
Returns a reference to the value corresponding to the supplied name.
Panics
Panics if the name is not present in Trailers
.
impl Index<HeaderName> for Trailers
[src]
impl Index<HeaderName> for Trailers
[src]type Output = HeaderValues
The returned type after indexing.
fn index(&self, name: HeaderName) -> &HeaderValues
[src]
Returns a reference to the value corresponding to the supplied name.
Panics
Panics if the name is not present in Trailers
.
Auto Trait Implementations
impl RefUnwindSafe for Trailers
impl RefUnwindSafe for Trailers
impl UnwindSafe for Trailers
impl UnwindSafe for Trailers