pub struct Table { /* private fields */ }
Expand description
Contains the data read from a csv Assumes nonzero columns and rows
Implementations§
Source§impl Table
impl Table
pub fn new() -> Self
Sourcepub fn dims(&self) -> (usize, usize)
pub fn dims(&self) -> (usize, usize)
Returns the dimensions of the data within the table. Cache this value
Sourcepub fn col_widths(&self) -> Vec<i32>
pub fn col_widths(&self) -> Vec<i32>
Calculates the max characters needed to display all values in a column. Needs rewrite to be more efficient (after removing headers) Also cache this value
Sourcepub fn fmt_iter(&self) -> Vec<Vec<String>>
pub fn fmt_iter(&self) -> Vec<Vec<String>>
Add iterator for column widths along with row value? for (cell, width) in row.iter().zip(table.col_widths().iter()) { actually do fmt
Sourcepub fn rows(&self) -> Vec<Vec<String>>
pub fn rows(&self) -> Vec<Vec<String>>
Gets the internal data Should be formalized as iterators
Sourcepub fn add_row_before(&mut self, c: Cursor)
pub fn add_row_before(&mut self, c: Cursor)
Adds row before the cursor location.
Sourcepub fn add_row_after(&mut self, c: Cursor)
pub fn add_row_after(&mut self, c: Cursor)
Adds row after the cursor location.
Sourcepub fn add_col_before(&mut self, c: Cursor)
pub fn add_col_before(&mut self, c: Cursor)
Adds column before the cursor location.
Sourcepub fn add_col_after(&mut self, c: Cursor)
pub fn add_col_after(&mut self, c: Cursor)
Adds column after the cursor location.
Sourcepub fn delete_row(&mut self, c: &mut Cursor)
pub fn delete_row(&mut self, c: &mut Cursor)
Deletes the row the cursor lies.
Sourcepub fn delete_col(&mut self, c: &mut Cursor)
pub fn delete_col(&mut self, c: &mut Cursor)
Deletes the column the cursor lies.
Sourcepub fn save_to_path(&self, path: String)
pub fn save_to_path(&self, path: String)
Writes the data as a csv to the given path.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more