Stream

Struct Stream 

Source
pub struct Stream<T, Out: Write> { /* private fields */ }
Expand description

Allows printing rows of data to some io::Write.

Implementations§

Source§

impl<T, Out: Write> Stream<T, Out>

Source

pub fn new(output: Out, columns: Vec<Column<T>>) -> Self

Create a new table streamer.

Source

pub fn borders(self, borders: bool) -> Self

Enable right/left borders? (default: false)

Source

pub fn max_width(self, max_width: usize) -> Self

Set the maximum width for the table. Note: this may be increased automatically for you if you’ve specified columns, borders, dividers, and paddings with sizes that require a larger max_width.

Source

pub fn padding(self, padding: bool) -> Self

Enable horizontal padding around | dividers and inside external borders. (default: true)

Source

pub fn grow(self, grow: bool) -> Self

Should the table grow to fit its max_size?

Default behavior is determined by how much data we send to Stream.

  1. If we .finish() before the buffer is full, and determine that the table can be rendered smaller, then we will do so. (grow=false)
  2. If we fill the buffer and begin streaming mode, we’ll grow the table so that there will be spare width later if we need it. (grow=true)
Source

pub fn title(self, title: &str) -> Self

Set a table title, to be displayed centered above the table.

Source

pub fn row(&mut self, data: T) -> Result<()>

Print a single row. Note: Stream may buffer some rows before it begins output to calculate column sizes.

Source

pub fn finish(self) -> Result<()>

Finish writing output. This may write any items still in the buffer, as well as a trailing horizontal line and footer.

Source

pub fn footer(self, footer: &str) -> Result<()>

Like [finish], but adds a footer at the end as well.

Auto Trait Implementations§

§

impl<T, Out> Freeze for Stream<T, Out>
where Out: Freeze,

§

impl<T, Out> !RefUnwindSafe for Stream<T, Out>

§

impl<T, Out> !Send for Stream<T, Out>

§

impl<T, Out> !Sync for Stream<T, Out>

§

impl<T, Out> Unpin for Stream<T, Out>
where Out: Unpin, T: Unpin,

§

impl<T, Out> !UnwindSafe for Stream<T, Out>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.