Type Alias Body

Source
pub type Body = Body;
Expand description

A hyper::Body type alias.

Aliased Type§

struct Body { /* private fields */ }

Implementations

Source§

impl Body

Source

pub fn empty() -> Body

Create an empty Body stream.

§Example
use hyper::{Body, Request};

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

pub fn channel() -> (Sender, Body)

Create a Body stream with an associated sender half.

Useful when wanting to stream chunks from another thread.

Trait Implementations

Source§

impl Debug for Body

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Body

Source§

fn default() -> Body

Returns Body::empty().

Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl From<&'static str> for Body

Source§

fn from(slice: &'static str) -> Body

Converts to this type from the input type.
Source§

impl From<Bytes> for Body

Source§

fn from(chunk: Bytes) -> Body

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl From<Cow<'static, str>> for Body

Source§

fn from(cow: Cow<'static, str>) -> Body

Converts to this type from the input type.
Source§

impl From<String> for Body

Source§

fn from(s: String) -> Body

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Body

Source§

fn from(vec: Vec<u8>) -> Body

Converts to this type from the input type.
Source§

impl Body for Body

Source§

type Data = Bytes

Values yielded by the Body.
Source§

type Error = Error

The error type this Body might generate.
Source§

fn poll_data( self: Pin<&mut Body>, cx: &mut Context<'_>, ) -> Poll<Option<Result<<Body as Body>::Data, <Body as Body>::Error>>>

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

fn poll_trailers( self: Pin<&mut Body>, cx: &mut Context<'_>, ) -> Poll<Result<Option<HeaderMap>, <Body as Body>::Error>>

Poll for an optional single HeaderMap of trailers. Read more
Source§

fn is_end_stream(&self) -> bool

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

fn size_hint(&self) -> SizeHint

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

fn data(&mut self) -> Data<'_, Self>
where Self: Sized + Unpin,

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

fn trailers(&mut self) -> Trailers<'_, Self>
where Self: Sized + Unpin,

Returns future that resolves to trailers, if any.
Source§

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

Maps this body’s data value to a different value.
Source§

fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: FnMut(Self::Error) -> E,

Maps this body’s error value to a different value.
Source§

fn collect(self) -> Collect<Self>
where Self: Sized,

Turn this body into Collected body which will collect all the DATA frames and trailers.
Source§

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

Turn this body into a boxed trait object.
Source§

fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
where Self: Sized + Send + 'static,

Turn this body into a boxed trait object that is !Sync.