Struct buf_redux::LineWriter
[−]
[src]
pub struct LineWriter<W: Write>(_);
A drop-in replacement for std::io::LineWriter
with more functionality.
Methods
impl<W: Write> LineWriter<W>
[src]
fn new(inner: W) -> Self
[src]
Wrap inner
with the default buffer capacity.
fn with_capacity(capacity: usize, inner: W) -> Self
[src]
Wrap inner
with the given buffer capacity.
fn get_ref(&self) -> &W
[src]
Get a reference to the inner writer.
fn get_mut(&mut self) -> &mut W
[src]
Get a mutable reference to the inner writer.
Note
If the buffer has not been flushed, writing directly to the inner type will cause data inconsistency.
fn capacity(&self) -> usize
[src]
Get the capacty of the inner buffer.
fn buffered(&self) -> usize
[src]
Get the number of bytes currently in the buffer.
fn grow(&mut self, additional: usize)
[src]
Grow the internal buffer by at least additional
bytes. May not be
quite exact due to implementation details of the buffer's allocator.
Note
This should not be called frequently as each call will incur a reallocation.
fn into_inner(self) -> Result<W, IntoInnerError<Self>>
[src]
Flush the buffer and unwrap, returning the inner writer on success,
or a type wrapping self
plus the error otherwise.
fn into_inner_with_err(self) -> (W, Option<Error>)
[src]
Flush the buffer and unwrap, returning the inner writer and any error encountered during flushing.
fn into_inner_with_buf(self) -> (W, Vec<u8>)
[src]
Consume self
and return both the underlying writer and the buffer,
with the data moved to the beginning and the length truncated to contain
only valid data.
Trait Implementations
impl<W: Write> Write for LineWriter<W>
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
Write a buffer into this object, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>
[src]
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Creates a "by reference" adaptor for this instance of Write
. Read more