Struct tabwriter::TabWriter
[−]
[src]
pub struct TabWriter<W> { /* 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]
ⓘImportant traits for TabWriter<W>pub fn new(w: W) -> TabWriter<W>
[src]
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.
ⓘImportant traits for TabWriter<W>pub fn minwidth(self, minwidth: usize) -> TabWriter<W>
[src]
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
.
ⓘImportant traits for TabWriter<W>pub fn padding(self, padding: usize) -> TabWriter<W>
[src]
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
.
pub fn into_inner(self) -> Result<W, IntoInnerError<TabWriter<W>>>
[src]
Unwraps this TabWriter
, returning the underlying writer.
This internal buffer is flushed before returning the writer. If the flush fails, then an error is returned.
Trait Implementations
impl<W: Debug> Debug for TabWriter<W>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<W: Write> Write for TabWriter<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