Struct Table

Source
pub struct Table {
    pub border: Border,
    /* private fields */
}

Fields§

§border: Border

Implementations§

Source§

impl Table

Source

pub fn empty() -> Table

Returns an empty Table

Source

pub fn new( border: Border, column_breaks: Vec<CellWidth>, column_headers: Row, row_headers: Vec<Cell>, data_rows: Vec<Row>, ) -> Table

Returns a table from the supplied parameters.

§Arguments
  • border - Describes the table border.
  • column_breaks - Column breaks describe header row widths.
  • column_headers - The content for the column headers.
  • row_headers - The content for the row headers.
  • data_rows - The rows in the table body.
Source

pub fn from_vec( column_headers: Row, cell_styles: &[ContentStyle], data: &[&str], ) -> Table

Returns a table built from a string vector data source.

§Arguments
  • column_headers - The header row describes how to split the data.
  • cell_styles - The base styles to apply to each cell.
  • data - A vector containing the data for the table body.
§Panics

If a data item cannot be parsed.

Source

pub fn from_data_source<'a, I>( column_headers: Row, cell_styles: &[ContentStyle], row_headers: Vec<Cell>, data_source: I, ) -> Table
where I: Iterator<Item = &'a DataItem>,

Returns a table built from a data source.

§Arguments
  • column_headers - The header row describes how to split the data.
  • cell_styles - The base styles to apply to each cell.
  • row_headers - The row headers to put before each row.
  • data_source - An iterable source providing the table body data.
Source

pub fn format(self: &Table) -> String

Returns the contents of a table formatted as a string.

§Arguments
  • self - The table to format.

Trait Implementations§

Source§

impl Debug for Table

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Table

§

impl RefUnwindSafe for Table

§

impl Send for Table

§

impl Sync for Table

§

impl Unpin for Table

§

impl UnwindSafe for Table

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.