Struct std::io::BufWriter
[−]
[src]
pub struct BufWriter<W: Write> {
// some fields omitted
}Wraps a Writer and buffers output to it
It can be excessively inefficient to work directly with a Write. For
example, every call to write on TcpStream results in a system call. A
BufWriter keeps an in memory buffer of data and writes it to the
underlying Write in large, infrequent batches.
The buffer will be written out when the writer is dropped.
Methods
impl<W: Write> BufWriter<W>
fn new(inner: W) -> BufWriter<W>
Creates a new BufWriter with a default buffer capacity
fn with_capacity(cap: usize, inner: W) -> BufWriter<W>
Creates a new BufWriter with the specified buffer capacity
fn get_ref(&self) -> &W
Gets a reference to the underlying writer.
fn get_mut(&mut self) -> &mut W
Gets a mutable reference to the underlying write.
Warning
It is inadvisable to directly read from the underlying writer.
fn into_inner(self) -> Result<W, IntoInnerError<BufWriter<W>>>
Unwraps this BufWriter, returning the underlying writer.
The buffer is written out before returning the writer.