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

pub enum HttpWriter<W: Writer> {
    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: Writer> HttpWriter<W>

fn unwrap(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) -> IoResult<W>

Ends the HttpWriter, and returns the underlying Writer.

A final write() 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: Writer> Writer for HttpWriter<W>

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

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

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

fn write_str(&mut self, s: &str) -> Result<(), IoError>

fn write_line(&mut self, s: &str) -> Result<(), IoError>

fn write_char(&mut self, c: char) -> Result<(), IoError>

fn write_int(&mut self, n: isize) -> Result<(), IoError>

fn write_uint(&mut self, n: usize) -> Result<(), IoError>

fn write_le_uint(&mut self, n: usize) -> Result<(), IoError>

fn write_le_int(&mut self, n: isize) -> Result<(), IoError>

fn write_be_uint(&mut self, n: usize) -> Result<(), IoError>

fn write_be_int(&mut self, n: isize) -> Result<(), IoError>

fn write_be_u64(&mut self, n: u64) -> Result<(), IoError>

fn write_be_u32(&mut self, n: u32) -> Result<(), IoError>

fn write_be_u16(&mut self, n: u16) -> Result<(), IoError>

fn write_be_i64(&mut self, n: i64) -> Result<(), IoError>

fn write_be_i32(&mut self, n: i32) -> Result<(), IoError>

fn write_be_i16(&mut self, n: i16) -> Result<(), IoError>

fn write_be_f64(&mut self, f: f64) -> Result<(), IoError>

fn write_be_f32(&mut self, f: f32) -> Result<(), IoError>

fn write_le_u64(&mut self, n: u64) -> Result<(), IoError>

fn write_le_u32(&mut self, n: u32) -> Result<(), IoError>

fn write_le_u16(&mut self, n: u16) -> Result<(), IoError>

fn write_le_i64(&mut self, n: i64) -> Result<(), IoError>

fn write_le_i32(&mut self, n: i32) -> Result<(), IoError>

fn write_le_i16(&mut self, n: i16) -> Result<(), IoError>

fn write_le_f64(&mut self, f: f64) -> Result<(), IoError>

fn write_le_f32(&mut self, f: f32) -> Result<(), IoError>

fn write_u8(&mut self, n: u8) -> Result<(), IoError>

fn write_i8(&mut self, n: i8) -> Result<(), IoError>