[][src]Struct httpcodec::BodyEncoder

pub struct BodyEncoder<E>(_);

Basic HTTP body encoder.

It is typically used for making a body encoder from a Encode implementor.

If E::requiring_bytes() returns ByteCount::Unknown, the chunked body transfer encoding will be used.

Methods

impl<E> BodyEncoder<E>[src]

pub fn new(inner: E) -> Self[src]

Makes a new BodyEncoder instance.

Trait Implementations

impl<E: Encode> BodyEncode for BodyEncoder<E>[src]

impl<E: Default> Default for BodyEncoder<E>[src]

impl<E: Debug> Debug for BodyEncoder<E>[src]

impl<E: Encode> Encode for BodyEncoder<E>[src]

type Item = E::Item

The type of items to be encoded.

Auto Trait Implementations

impl<E> Unpin for BodyEncoder<E> where
    E: Unpin

impl<E> Send for BodyEncoder<E> where
    E: Send

impl<E> Sync for BodyEncoder<E> where
    E: Sync

impl<E> RefUnwindSafe for BodyEncoder<E> where
    E: RefUnwindSafe

impl<E> UnwindSafe for BodyEncoder<E> where
    E: UnwindSafe

Blanket Implementations

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

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

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.

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

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

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

impl<T> EncodeExt for T where
    T: Encode
[src]

fn with_item(item: Self::Item) -> Result<Self, Error> where
    Self: Default
[src]

Creates a new encoder instance that has the given initial item. Read more

fn map_err<E, F>(self, f: F) -> MapErr<Self, E, F> where
    F: Fn(Error) -> E,
    Error: From<E>, 
[src]

Creates an encoder for modifying encoding errors produced by self. Read more

fn map_from<T, F>(self, f: F) -> MapFrom<Self, T, F> where
    F: Fn(T) -> Self::Item
[src]

Creates an encoder that converts items into ones that suited to the self encoder by calling the given function. Read more

fn try_map_from<T, E, F>(self, f: F) -> TryMapFrom<Self, T, E, F> where
    F: Fn(T) -> Result<Self::Item, E>,
    Error: From<E>, 
[src]

Creates an encoder that tries to convert items into ones that suited to the self encoder by calling the given function. Read more

fn optional(self) -> Optional<Self>[src]

Creates an encoder that represents an optional encoder. Read more

fn max_bytes(self, n: u64) -> MaxBytes<Self>[src]

Creates an encoder that will fail if the number of encoded bytes of an item exceeds n. Read more

fn length(self, n: u64) -> Length<Self>[src]

Creates an encoder that required to encode each item exactly at the specified number of bytes. Read more

fn chain<T>(self, other: T) -> TupleEncoder<(Self, T)> where
    T: Encode
[src]

Takes two encoders and creates a new encoder that encodes both items in sequence. Read more

fn repeat<I>(self) -> Repeat<Self, I> where
    I: Iterator<Item = Self::Item>, 
[src]

Creates an encoder that repeats encoding of Self::Item. Read more

fn pre_encode(self) -> PreEncode<Self>[src]

Creates an encoder that pre-encodes items when start_encoding method is called. Read more

fn slice(self) -> Slice<Self>[src]

Creates an encoder that makes it possible to slice the encoded byte sequence in arbitrary units. Read more

fn last(self, item: Self::Item) -> Last<Self>[src]

Creates an encoder that cannot accept any more items except the given one.

fn encode_into_bytes(&mut self, item: Self::Item) -> Result<Vec<u8>, Error>[src]

Encodes the given item and returns the resulting bytes. Read more

impl<T> IoEncodeExt for T where
    T: Encode
[src]

fn encode_to_write_buf<B>(&mut self, buf: &mut WriteBuf<B>) -> Result<(), Error> where
    B: AsMut<[u8]>, 
[src]

Encodes the items remaining in the encoder and writes the encoded bytes to the given write buffer. Read more

fn encode_all<W>(&mut self, writer: W) -> Result<(), Error> where
    W: Write
[src]

Encodes all of the items remaining in the encoder and writes the encoded bytes to the given writer. Read more