Struct tabwriter::TabWriter
[−]
[src]
pub struct TabWriter<W> { // some fields omitted }
TabWriter wraps an arbitrary writer and aligns tabbed output.
Elastic tabstops work by aligning contiguous tabbed delimited fields
known as column blocks. When a line appears that breaks all contiguous
blocks, all buffered output will be flushed to the underlying writer.
Otherwise, output will stay buffered until flush
is explicitly called.
Methods
impl<W: Write> TabWriter<W>
[src]
fn new(w: W) -> TabWriter<W>
Create a new TabWriter
from an existing Writer
.
All output written to Writer
is passed through TabWriter
.
Contiguous column blocks indicated by tabs are aligned.
Note that flush
must be called to guarantee that TabWriter
will
write to the given writer.
fn minwidth(self, minwidth: usize) -> TabWriter<W>
Set the minimum width of each column. That is, all columns will have
at least the size given here. If a column is smaller than minwidth
,
then it is passed with spaces.
The default minimum width is 2
.
fn padding(self, padding: usize) -> TabWriter<W>
Set the padding between columns. All columns will be separated by
at least the number of spaces indicated by padding
. If padding
is zero, then columns may run up against each other without any
separation.
The default padding is 2
.
fn unwrap(self) -> W
Returns the underlying writer. Note that flush
must be called before
unwrapping or else data will likely be lost.
Trait Implementations
impl<W: Write> Write for TabWriter<W>
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this object, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>
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
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0
Creates a "by reference" adaptor for this instance of Write
. Read more