Enum hyper::http::HttpWriter [] [src]

pub enum HttpWriter<W: Write> {
    ThroughWriter(W),
    ChunkedWriter(W),
    SizedWriter(W, u64),
    EmptyWriter(W),
}

Writers to handle different Transfer-Encodings.

Variants

ThroughWriter

A no-op Writer, used initially before Transfer-Encoding is determined.

ChunkedWriter

A Writer for when Transfer-Encoding includes chunked.

SizedWriter

A Writer for when Content-Length is set.

Enforces that the body is not longer than the Content-Length header.

EmptyWriter

A writer that should not write any body.

Methods

impl<W: Write> HttpWriter<W>

fn into_inner(self) -> W

Unwraps the HttpWriter and returns the underlying Writer.

fn get_ref<'a>(&'a self) -> &'a W

Access the inner Writer.

fn get_mut<'a>(&'a mut self) -> &'a mut W

Access the inner Writer mutably.

Warning: You should not write to this directly, as you can corrupt the state.

fn end(self) -> Result<W>

Ends the HttpWriter, and returns the underlying Writer.

A final write_all() is called with an empty message, and then flushed. The ChunkedWriter variant will use this to write the 0-sized last-chunk.

Trait Implementations

impl<W: Write> Write for HttpWriter<W>

fn write(&mut self, msg: &[u8]) -> Result<usize>

fn flush(&mut self) -> Result<()>

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>

fn by_ref(&mut self) -> &mut Self

fn broadcast<W>(self, other: W) -> Broadcast<Self, W> where W: Write

impl<W: Write> Debug for HttpWriter<W>

fn fmt(&self, fmt: &mut Formatter) -> Result