A crate for separately buffered streams.
This crate provides a
BufStream type which provides buffering of both the
reading and writing halves of a
Read + Write type. Each half is completely
independently buffered of the other, which may not always be desired. For
BufStream<File> may have surprising semantics.
[dependencies] bufstream = "0.1"
use std::io::prelude::*; use std::net::TcpStream; use bufstream::BufStream; let stream = TcpStream::connect("localhost:4000").unwrap(); let mut buf = BufStream::new(stream); buf.read(&mut [0; 1024]).unwrap(); buf.write(&[0; 1024]).unwrap();