Struct tabled::tables::CompactTable

source ·
pub struct CompactTable<I, D> { /* private fields */ }
Expand description

A table which consumes an IntoRecords iterator. It assumes that the content has only single line.

Implementations§

source§

impl<I> CompactTable<I, ConstDimension<0, 0>>

source

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

Creates a new CompactTable structure with a width dimension for all columns.

source§

impl<I, const ROWS: usize, const COLS: usize> CompactTable<I, ConstDimension<COLS, ROWS>>

source

pub fn height<S: Into<ConstSize<COUNT_ROWS>>, const COUNT_ROWS: usize>( self, size: S ) -> CompactTable<I, ConstDimension<COLS, COUNT_ROWS>>

Set a height for each row.

source

pub fn width<S: Into<ConstSize<COUNT_COLUMNS>>, const COUNT_COLUMNS: usize>( self, size: S ) -> CompactTable<I, ConstDimension<COUNT_COLUMNS, ROWS>>

Set a width for each column.

source§

impl<I, D> CompactTable<I, D>

source

pub fn with_dimension(iter: I, dimension: D) -> Self
where I: IntoRecords,

Creates a new CompactTable structure with a known dimension.

Notice that the function wont call Estimate.

source

pub fn with<O>(self, option: O) -> Self
where for<'a> O: TableOption<IterRecords<&'a I>, CompactConfig, D>,

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

source

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

Limit a number of rows.

source

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

Limit a number of columns.

source

pub fn get_config(&self) -> &CompactConfig

Returns a table config.

source

pub fn get_config_mut(&mut self) -> &mut CompactConfig

Returns a table config.

source

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

Format table into fmt::Writeer.

source

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

Available on crate feature std only.

Format table into a writer.

source

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

Available on crate feature std only.

Build a string.

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

Trait Implementations§

source§

impl<I: Clone, D: Clone> Clone for CompactTable<I, D>

source§

fn clone(&self) -> CompactTable<I, D>

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, D: Debug> Debug for CompactTable<I, D>

source§

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

Formats the value using the given formatter. Read more
source§

impl<T, const ROWS: usize, const COLS: usize> From<[[T; COLS]; ROWS]> for CompactTable<[[T; COLS]; ROWS], ConstDimension<COLS, ROWS>>
where T: AsRef<str>,

source§

fn from(mat: [[T; COLS]; ROWS]) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<I, D> RefUnwindSafe for CompactTable<I, D>

§

impl<I, D> Send for CompactTable<I, D>
where D: Send, I: Send,

§

impl<I, D> Sync for CompactTable<I, D>
where D: Sync, I: Sync,

§

impl<I, D> Unpin for CompactTable<I, D>
where D: Unpin, I: Unpin,

§

impl<I, D> UnwindSafe for CompactTable<I, D>
where D: UnwindSafe, 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.