[][src]Struct http_types::Trailers

pub struct Trailers { /* fields omitted */ }

A collection of trailing HTTP headers.

Methods

impl Trailers[src]

pub fn new() -> Self[src]

Create a new instance of Trailers.

pub fn insert(
    &mut self,
    name: impl TryInto<HeaderName>,
    values: impl ToHeaderValues
) -> Result<Option<Vec<HeaderValue>>>
[src]

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 TryInto<HeaderName>,
    values: impl ToHeaderValues
) -> Result<()>
[src]

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: &HeaderName) -> Option<&Vec<HeaderValue>>[src]

Get a reference to a header.

pub fn get_mut(&mut self, name: &HeaderName) -> Option<&mut Vec<HeaderValue>>[src]

Get a mutable reference to a header.

pub fn remove(&mut self, name: &HeaderName) -> Option<Vec<HeaderValue>>[src]

Remove a header.

pub fn iter<'a>(&'a self) -> Iter<'a>[src]

An iterator visiting all header pairs in arbitrary order.

pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a>[src]

An iterator visiting all header pairs in arbitrary order, with mutable references to the values.

pub fn names<'a>(&'a self) -> Names<'a>[src]

An iterator visiting all header names in arbitrary order.

pub fn values<'a>(&'a self) -> Values<'a>[src]

An iterator visiting all header values in arbitrary order.

Methods from Deref<Target = Headers>

pub fn insert(
    &mut self,
    name: impl TryInto<HeaderName>,
    values: impl ToHeaderValues
) -> Result<Option<Vec<HeaderValue>>>
[src]

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 TryInto<HeaderName>,
    values: impl ToHeaderValues
) -> Result<()>
[src]

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: &HeaderName) -> Option<&Vec<HeaderValue>>[src]

Get a reference to a header.

pub fn get_mut(&mut self, name: &HeaderName) -> Option<&mut Vec<HeaderValue>>[src]

Get a mutable reference to a header.

pub fn remove(&mut self, name: &HeaderName) -> Option<Vec<HeaderValue>>[src]

Remove a header.

pub fn iter<'a>(&'a self) -> Iter<'a>[src]

An iterator visiting all header pairs in arbitrary order.

pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a>[src]

An iterator visiting all header pairs in arbitrary order, with mutable references to the values.

pub fn names<'a>(&'a self) -> Names<'a>[src]

An iterator visiting all header names in arbitrary order.

pub fn values<'a>(&'a self) -> Values<'a>[src]

An iterator visiting all header values in arbitrary order.

Trait Implementations

impl Clone for Trailers[src]

impl Debug for Trailers[src]

impl Deref for Trailers[src]

type Target = Headers

The resulting type after dereferencing.

impl DerefMut for Trailers[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.