Expand description
This crate implements a zero-copy, zero-allocation writer for HTTP chunked response
bodies. The result can be written
directly into a
TcpStream
or any
other object that implements
Write
.
§Example
use uhttp_chunked_write::ChunkedWrite;
use std::io::Write;
let mut buf = [0; 25];
{
let mut body = ChunkedWrite::new(&mut buf[..]);
write!(&mut body, "hello {}", 1337).unwrap();
}
assert_eq!(&buf[..], &b"6\r\nhello \r\n4\r\n1337\r\n0\r\n\r\n"[..]);
Structs§
- Chunked
Write - Writes bytes in the HTTP chunked encoding protocol.