Struct tabled::tables::IterTable

source ·
pub struct IterTable<I> { /* private fields */ }
Available on crate feature std only.
Expand description

A table which consumes an IntoRecords iterator.

To be able to build table we need a dimensions. If no width and count_columns is set, IterTable will sniff the records, by keeping a number of rows buffered (You can set the number via IterTable::sniff).

Implementations§

source§

impl<I> IterTable<I>

source

pub fn new(iter: I) -> Self
where I: IntoRecords,

Creates a new IterTable structure.

source

pub fn with<O>(self, option: O) -> Self

With is a generic function which applies options to the IterTable.

source

pub fn columns(self, count_columns: usize) -> Self

Limit a number of columns.

source

pub fn rows(self, count_rows: usize) -> Self

Limit a number of rows.

source

pub fn sniff(self, count: usize) -> Self

Limit an amount of rows will be read for dimension estimations.

source

pub fn height(self, size: usize) -> Self

Set a height for each row.

source

pub fn width(self, size: usize) -> Self

Set a width for each column.

source

pub fn to_string(self) -> String
where I: IntoRecords, I::Cell: AsRef<str>,

Build a string.

We can’t implement std::string::ToString cause it does takes &self reference.

source

pub fn build<W>(self, writer: W) -> Result<()>
where W: Write, I: IntoRecords, I::Cell: AsRef<str>,

Format table into io::Writer.

source

pub fn fmt<W>(self, writer: W) -> Result
where W: Write, I: IntoRecords, I::Cell: AsRef<str>,

Format table into fmt::Writeer.

Trait Implementations§

source§

impl<I: Clone> Clone for IterTable<I>

source§

fn clone(&self) -> IterTable<I>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I: Debug> Debug for IterTable<I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<I> RefUnwindSafe for IterTable<I>
where I: RefUnwindSafe,

§

impl<I> Send for IterTable<I>
where I: Send,

§

impl<I> Sync for IterTable<I>
where I: Sync,

§

impl<I> Unpin for IterTable<I>
where I: Unpin,

§

impl<I> UnwindSafe for IterTable<I>
where I: UnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.