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`Write. For example, every call to`. For example, every call to write`writeon` on TcpStream`TcpStreamresults in a system call. A` results in a system call. A BufWriter`BufWriterkeeps an in memory buffer of data and writes it to the underlying` keeps an in memory buffer of data and writes it to the underlying Write`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`BufWriter` with a default buffer capacity

fn with_capacity(cap: usize, inner: W) -> BufWriter<W>

Creates a new BufWriter`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`BufWriter`, returning the underlying writer.

The buffer is written out before returning the writer.

Trait Implementations

impl<W: Write> Write for BufWriter<W>

fn write(&mut self, buf: &[u8]) -> Result<usize>

fn flush(&mut self) -> Result<()>

fn write_all(&mut self, buf: &[u8]) -> Result<()>

fn write_fmt(&mut self, fmt: Arguments) -> Result<()>

fn by_ref(&mut self) -> &mut Self where Self: Sized

fn broadcast<W: Write>(self, other: W) -> Broadcast<Self, W> where Self: Sized

impl<W: Write> Debug for BufWriter<W> where W: Debug

fn fmt(&self, fmt: &mut Formatter) -> Result

impl<W: Write + Seek> Seek for BufWriter<W>

fn seek(&mut self, pos: SeekFrom) -> Result<u64>

impl<W: Write> Drop for BufWriter<W>

fn drop(&mut self)