Wraps a writer and buffers output to it, flushing whenever a newline
'\n') is detected.
BufWriter struct wraps a writer and buffers its output.
But it only does this batched write when it goes out of scope, or when the
internal buffer is full. Sometimes, you'd prefer to write each line as it's
completed, rather than the entire buffer at once. Enter
does exactly that.
LineWriter’s buffer will also be flushed when the
LineWriter goes out of scope or when its internal buffer is full.
If there's still a partial line in the buffer when the
dropped, it will flush those contents.
impl<W: Write> LineWriter<W>[src]
pub fn new(inner: W) -> LineWriter<W>[src]
Creates a new
pub fn with_capacity(capacity: usize, inner: W) -> LineWriter<W>[src]
Creates a new
LineWriter with a specified capacity for the internal
Gets a reference to the underlying writer.
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.
pub fn into_inner(self) -> Result<W, IntoInnerError<LineWriter<W>>>[src]
LineWriter, returning the underlying writer.
The internal buffer is written out before returning the writer.
Err will be returned if an error occurs while flushing the buffer.
impl<W: Write> Debug for LineWriter<W> where[src]
impl<W: Write> Write for LineWriter<W>[src]
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>[src]
Auto Trait Implementations
impl<W> RefUnwindSafe for LineWriter<W> where
impl<W> Send for LineWriter<W> where
impl<W> Sync for LineWriter<W> where
impl<W> Unpin for LineWriter<W> where
impl<W> UnwindSafe for LineWriter<W> where
type Error = Infallible
The type returned in the event of a conversion error.