pub struct CsvTable {
pub headers: Vec<String>,
pub rows: Vec<Vec<String>>,
}Expand description
An in-memory table of string-valued cells.
Columns are named; rows are VecString`. Provides the foundation for
type inference, merge/join, pivot, and diff operations.
Fields§
§headers: Vec<String>Column headers.
rows: Vec<Vec<String>>Data rows (each row has headers.len() fields, padded with "" if short).
Implementations§
Source§impl CsvTable
impl CsvTable
Sourcepub fn from_str(data: &str, delimiter: char) -> Result<Self, Error>
pub fn from_str(data: &str, delimiter: char) -> Result<Self, Error>
Parse a CSV string into a CsvTable using the given delimiter.
Sourcepub fn to_csv_string(&self, delimiter: char) -> String
pub fn to_csv_string(&self, delimiter: char) -> String
Serialize back to a CSV string with the given delimiter.
Sourcepub fn column_values(&self, name: &str) -> Result<Vec<&str>, Error>
pub fn column_values(&self, name: &str) -> Result<Vec<&str>, Error>
Get all values from a named column as strings.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CsvTable
impl RefUnwindSafe for CsvTable
impl Send for CsvTable
impl Sync for CsvTable
impl Unpin for CsvTable
impl UnsafeUnpin for CsvTable
impl UnwindSafe for CsvTable
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.