pub struct TextTable { /* private fields */ }Expand description
Table of parsed CLI output with named columns.
Implementations§
Source§impl TextTable
impl TextTable
Sourcepub fn from_values(header: Vec<String>, values: Vec<Vec<Value>>) -> Self
pub fn from_values(header: Vec<String>, values: Vec<Vec<Value>>) -> Self
Create a table from header and value rows.
Sourcepub fn set_superkey(&mut self, keys: Vec<String>)
pub fn set_superkey(&mut self, keys: Vec<String>)
Set the superkey columns for sorting.
Sourcepub fn append_row(&mut self, row: Row)
pub fn append_row(&mut self, row: Row)
Append a Row object.
Sourcepub fn sort(&mut self)
pub fn sort(&mut self)
Sort by superkey (if set) or by first column. Uses natural sorting (numeric values sorted numerically, strings alphabetically).
Sourcepub fn sort_by_key<K, F>(&mut self, f: F)
pub fn sort_by_key<K, F>(&mut self, f: F)
Sort by a key function.
Sourcepub fn row_with(&self, column: &str, value: &str) -> Option<&Row>
pub fn row_with(&self, column: &str, value: &str) -> Option<&Row>
Find the first row where a column has a specific value.
Sourcepub fn into_values(self) -> Vec<Vec<Value>>
pub fn into_values(self) -> Vec<Vec<Value>>
Convert to Vec<Vec
Trait Implementations§
Source§impl<'a> IntoIterator for &'a TextTable
impl<'a> IntoIterator for &'a TextTable
Auto Trait Implementations§
impl Freeze for TextTable
impl RefUnwindSafe for TextTable
impl Send for TextTable
impl Sync for TextTable
impl Unpin for TextTable
impl UnwindSafe for TextTable
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