bufstream 0.1.2

Buffered I/O for streams where each read/write half is separately buffered

Crate bufstream [] [src]

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 example BufStream<File> may have surprising semantics.


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();



Wraps a Stream and buffers input and output to and from it.


An error returned by into_inner which combines an error that happened while writing out the buffer, and the buffered writer object which may be used to recover from the condition.