Struct http_types::trailers::Trailers [−][src]
pub struct Trailers { /* fields omitted */ }
Expand description
A collection of trailing HTTP headers.
Implementations
pub fn insert(
&mut self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
) -> Option<HeaderValues>
pub fn insert(
&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");
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");
Get a reference to a header.
Get a mutable reference to a header.
Remove a header.
An iterator visiting all header pairs in arbitrary order.
An iterator visiting all header pairs in arbitrary order, with mutable references to the values.
An iterator visiting all header names in arbitrary order.
Methods from Deref<Target = Headers>
pub fn insert(
&mut self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
) -> Option<HeaderValues>
pub fn insert(
&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
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.
Get a reference to a header.
Get a mutable reference to a header.
Remove a header.
An iterator visiting all header pairs in arbitrary order.
An iterator visiting all header pairs in arbitrary order, with mutable references to the values.
An iterator visiting all header names in arbitrary order.
Trait Implementations
Returns a reference to the value corresponding to the supplied name.
Panics
Panics if the name is not present in Trailers
.
type Output = HeaderValues
type Output = HeaderValues
The returned type after indexing.
Returns a reference to the value corresponding to the supplied name.
Panics
Panics if the name is not present in Trailers
.
type Output = HeaderValues
type Output = HeaderValues
The returned type after indexing.
Auto Trait Implementations
impl RefUnwindSafe for Trailers
impl UnwindSafe for Trailers
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self