# Struct hyper::Body [−] [src]

    #[must_use = "streams do nothing unless polled"]pub struct Body { /* fields omitted */ }

A stream of `Bytes`, used when receiving bodies.

A good default `HttpBody` to use in many applications.

## Implementations

### `impl Body` [src]

#### `pub fn empty() -> Body` [src]

Create an empty `Body` stream.

# Example

    use hyper::{Body, Request};

    // create a `GET /` request
    let get = Request::new(Body::empty());

#### `pub fn channel() -> (Sender, Body)` [src]

Create a `Body` stream with an associated sender half.

Useful when wanting to stream chunks from another thread.

## Trait Implementations

### `impl Body for Body` [src]

#### `type Data = Bytes`

Values yielded by the `Body`.

#### `type Error = Error`

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

#### `pub fn data(&mut self) -> Data<'_, Self> where
Self: Unpin,` [src]

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

#### `pub fn trailers(&mut self) -> Trailers<'_, Self> where
Self: Unpin,` [src]

Returns future that resolves to trailers, if any.

### `impl Debug for Body` [src]

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

Formats the value using the given formatter. Read more

### `impl Default for Body` [src]

#### `fn default() -> Body` [src]

Returns `Body::empty()`.

### `impl From<&'static [u8]> for Body` [src]

#### `fn from(slice: &'static [u8]) -> Body` [src]

Performs the conversion.

### `impl From<&'static str> for Body` [src]

#### `fn from(slice: &'static str) -> Body` [src]

Performs the conversion.

### `impl From<Bytes> for Body` [src]

#### `fn from(chunk: Bytes) -> Body` [src]

Performs the conversion.

### `impl From<Cow<'static, [u8]>> for Body` [src]

#### `fn from(cow: Cow<'static, [u8]>) -> Body` [src]

Performs the conversion.

### `impl From<Cow<'static, str>> for Body` [src]

#### `fn from(cow: Cow<'static, str>) -> Body` [src]

Performs the conversion.

### `impl From<String> for Body` [src]

#### `fn from(s: String) -> Body` [src]

Performs the conversion.

### `impl From<Vec<u8, Global>> for Body` [src]

#### `fn from(vec: Vec<u8>) -> Body` [src]

Performs the conversion.

## Auto Trait Implementations

### `impl !RefUnwindSafe for Body`

### `impl Send for Body`

### `impl Sync for Body`

### `impl Unpin for Body`

### `impl !UnwindSafe for Body`

## 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> Instrument for T` [src]

#### `pub fn instrument(self, span: Span) -> Instrumented<Self>` [src]

Instruments this type with the provided `Span`, returning an `Instrumented` wrapper. Read more

#### `pub fn in_current_span(self) -> Instrumented<Self>` [src]

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more

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