# http_body::combinators::BoxBody - Rust
API documentation for the Rust `BoxBody` struct in crate `http_body`.
Keywords: rust, rustlang, rust-lang, BoxBody

# Struct http_body::combinators::BoxBody [−] [src]

    pub struct BoxBody<D, E> { /* fields omitted */ }

A boxed `Body` trait object.

## Implementations

### `impl<D, E> BoxBody<D, E>` [src]

#### `pub fn new<B>(body: B) -> Self where
B: Body<Data = D, Error = E> + Send + Sync + 'static,
D: Buf,` [src]

Create a new `BoxBody`.

## Trait Implementations

### `impl<D, E> Body for BoxBody<D, E> where
D: Buf,` [src]

#### `type Data = D`

Values yielded by the `Body`.

#### `type Error = E`

The error type this `Body` might generate.

#### `fn poll_data(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Option<Result<Self::Data, Self::Error>>>` [src]

Attempt to pull out the next data buffer of this stream.

#### `fn poll_trailers(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Result<Option<HeaderMap>, Self::Error>>` [src]

Poll for an optional single `HeaderMap` of trailers. Read more

#### `fn is_end_stream(&self) -> bool` [src]

Returns `true` when the end of stream has been reached. Read more

#### `fn size_hint(&self) -> SizeHint` [src]

Returns the bounds on the remaining length of the stream. Read more

#### `fn data(&mut self) -> Data<'_, Self>ⓘ

### Notable traits for Data<'a, T>

`impl<'a, T: Body + Unpin + ?Sized> Future for Data<'a, T> type Output = Option<Result<T::Data, T::Error>>;`
where
Self: Unpin + Sized,` [src]

Returns future that resolves to next data chunk, if any.

#### `fn trailers(&mut self) -> Trailers<'_, Self>ⓘ

### Notable traits for Trailers<'a, T>

`impl<'a, T: Body + Unpin + ?Sized> Future for Trailers<'a, T> type Output = Result<Option<HeaderMap>, T::Error>;`
where
Self: Unpin + Sized,` [src]

Returns future that resolves to trailers, if any.

#### `fn map_data<F, B>(self, f: F) -> MapData<Self, F> where
Self: Sized,
F: FnMut(Self::Data) -> B,
B: Buf,` [src]

Maps this body's data value to a different value.

#### `fn map_err<F, E>(self, f: F) -> MapErr<Self, F> where
Self: Sized,
F: FnMut(Self::Error) -> E,` [src]

Maps this body's error value to a different value.

#### `fn boxed(self) -> BoxBody<Self::Data, Self::Error> where
Self: Sized + Send + Sync + 'static,` [src]

Turn this body into a boxed trait object.

### `impl<D, E> Debug for BoxBody<D, E>` [src]

#### `fn fmt(&self, f: &mut Formatter<'_>) -> Result` [src]

Formats the value using the given formatter. Read more

## Auto Trait Implementations

### `impl<D, E> !RefUnwindSafe for BoxBody<D, E>` [src]

### `impl<D, E> Send for BoxBody<D, E>` [src]

### `impl<D, E> Sync for BoxBody<D, E>` [src]

### `impl<D, E> Unpin for BoxBody<D, E>` [src]

### `impl<D, E> !UnwindSafe for BoxBody<D, E>` [src]

## Blanket Implementations

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

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

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

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

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

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

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

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

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

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `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.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `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.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.