Struct table_print::Table[][src]

pub struct Table {
    pub headers: Vec<String>,
    pub content: Vec<Vec<String>>,
}

Fields

headers: Vec<String>

These are the table headings. For example, if counting days of the week, this may be `[“Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”]

content: Vec<Vec<String>>

This is the main content of the table. This goes below the heading.

The unnested vec is the X, the nested is the Y.

Implementations

impl Table[src]

pub fn new(headers: Vec<String>) -> Self[src]

Creates a new TablePrint.

pub fn with_content(headers: Vec<String>, content: Vec<Vec<String>>) -> Self[src]

Creates a TablePrint with content

pub fn insert_row(&mut self, row: Vec<String>)[src]

Inserts a row into the table.

pub fn get_row(&self, row: usize) -> Option<Vec<&str>>[src]

Retrieves a row from the table, this is given as a reference.

If you need mutability have a look at Self::get_row_mut

pub fn get_row_mut(&mut self, row: usize) -> Option<Vec<&mut str>>[src]

Retrieves a mutable row from the table, this is given as a reference.

pub fn get_column_count(&self) -> usize[src]

Retrieves the column count, not including the header.

pub fn get_row_count(&self) -> usize[src]

Retrieves the count of rows, not including the header.

pub fn get_csv(&self) -> String[src]

Turns this into a CSV string.

pub fn get_html(&self, embeded_css: Option<&str>) -> String[src]

Turns this into a HTML table. This function generates a complete HTML document. If only a singal element is required than have a look at Self::get_html_element

pub fn get_html_element(&self) -> String[src]

Turns this into a single HTML element.

pub fn get_pretty(&self, width: usize) -> Result<String, PrettyError>[src]

Gets a pretty version of this. Width is the max width this can take up and should probably just be the terminal width.

Trait Implementations

impl Clone for Table[src]

impl Debug for Table[src]

impl Default for Table[src]

impl Eq for Table[src]

impl Hash for Table[src]

impl Ord for Table[src]

impl PartialEq<Table> for Table[src]

impl PartialOrd<Table> for Table[src]

impl StructuralEq for Table[src]

impl StructuralPartialEq for Table[src]

Auto Trait Implementations

impl RefUnwindSafe for Table

impl Send for Table

impl Sync for Table

impl Unpin for Table

impl UnwindSafe for Table

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.