Struct chunked_transfer::Encoder [] [src]

pub struct Encoder<W> where W: Write {
    // some fields omitted

Splits the incoming data into HTTP chunks.


use chunked_transfer::Encoder;
use std::io::Write;

let mut decoded = "hello world";
let mut encoded: Vec<u8> = vec![];

    let mut encoder = Encoder::with_chunks_size(&mut encoded, 5);

assert_eq!(encoded, b"5\r\nhello\r\n5\r\n worl\r\n1\r\nd\r\n0\r\n\r\n");


impl<W> Encoder<W> where W: Write

fn new(output: W) -> Encoder<W>

fn with_chunks_size(output: W, chunks: usize) -> Encoder<W>

Trait Implementations

impl<W> Write for Encoder<W> where W: Write

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

Write a buffer into this object, returning how many bytes were written. Read more

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

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

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

Attempts to write an entire buffer into this write. Read more

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

Writes a formatted string into this writer, returning any error encountered. Read more

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

Creates a "by reference" adaptor for this instance of Write. Read more

impl<W> Drop for Encoder<W> where W: Write

fn drop(&mut self)

A method called when the value goes out of scope. Read more