generic<W: Writer> struct BufWriter {
&W inner;
unsigned long len;
unsigned char buf[IO_BUF_SIZE];
}Fields
the stream written to (borrowed)
bytes waiting in buf
Methods
Writer: takes all of data (into the buffer, or, for a write that doesn't fit, after flushing it, straight to the stream when it is at least IO_BUF_SIZE). data.len, or -1 if the stream failed.
Flusher: writes out everything buffered. 0 on success, -1 if the stream failed (the buffered bytes are dropped either way).