[−][src]Struct tabwriter::TabWriter
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 padded 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
.
ⓘImportant traits for TabWriter<W>pub fn alignment(self, alignment: Alignment) -> TabWriter<W>
[src]
Set the alignment of text within cells. This will effect future flushes.
The default alignment is Alignment::Left
.
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]
impl<W: Write> Write for TabWriter<W>
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
fn flush(&mut self) -> Result<()>
[src]
fn write_vectored(&mut self, bufs: &[IoSlice]) -> Result<usize, Error>
1.36.0[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl<W> RefUnwindSafe for TabWriter<W> where
W: RefUnwindSafe,
W: RefUnwindSafe,
impl<W> Send for TabWriter<W> where
W: Send,
W: Send,
impl<W> Sync for TabWriter<W> where
W: Sync,
W: Sync,
impl<W> Unpin for TabWriter<W> where
W: Unpin,
W: Unpin,
impl<W> UnwindSafe for TabWriter<W> where
W: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,