Struct std::io::LineWriter [] [src]

pub struct LineWriter<W: Write> {
    // some fields omitted
}

Wraps a Writer and buffers output to it, flushing whenever a newline (0x0a, '\n') is detected.

The buffer will be written out when the writer is dropped.

Methods

impl<W: Write> LineWriter<W>

fn new(inner: W) -> LineWriter<W>

Creates a new LineWriter

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

Creates a new LineWriter with a specified capacity for the internal buffer.

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 writer.

Caution must be taken when calling methods on the mutable reference returned as extra writes could corrupt the output stream.

fn into_inner(self) -> Result<W, IntoInnerError<LineWriter<W>>>

Unwraps this LineWriter, returning the underlying writer.

The internal buffer is written out before returning the writer.

Trait Implementations

impl<W: Write> Write for LineWriter<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 LineWriter<W> where W: Debug

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