Expand description
Row
Row is implementated as a hashmap. You cannot iterate row without column information.
Fields
values: HashMap<String, Value>Implementations
sourceimpl Row
impl Row
pub fn new() -> Self
sourcepub fn to_vector(&self, columns: &[Column]) -> DcsvResult<Vec<&Value>>
pub fn to_vector(&self, columns: &[Column]) -> DcsvResult<Vec<&Value>>
Convert row to vector with given columns
It is totally valid to give partial columns into a row.
sourcepub fn to_string(&self, columns: &[Column]) -> DcsvResult<String>
pub fn to_string(&self, columns: &[Column]) -> DcsvResult<String>
Get comma separated row string
This requires columns because a row is not a linear container.
sourcepub fn rename_column(&mut self, name: &str, new_name: &str)
pub fn rename_column(&mut self, name: &str, new_name: &str)
Rename column name inside row map
This doesn’t validate column’s name and should comply with column name rule to avoid unintended behaviour.
sourcepub fn insert_cell(&mut self, key: &str, value: Value)
pub fn insert_cell(&mut self, key: &str, value: Value)
Insert new cell(key, value pair) into a row
sourcepub fn get_cell_value(&self, key: &str) -> Option<&Value>
pub fn get_cell_value(&self, key: &str) -> Option<&Value>
Get cell value by key
sourcepub fn update_cell_value(&mut self, key: &str, value: Value)
pub fn update_cell_value(&mut self, key: &str, value: Value)
Update cell’s value with given value
This doesn’t fail and silently do nothing if key doesn’t exist.
sourcepub fn change_cell_type(
&mut self,
key: &str,
target_type: ValueType
) -> DcsvResult<()>
pub fn change_cell_type(
&mut self,
key: &str,
target_type: ValueType
) -> DcsvResult<()>
Chagnes cell’s value type
This method tries to naturally convert cell’s type. Empty text value defaults to “0”.
sourcepub fn remove_cell(&mut self, key: &str)
pub fn remove_cell(&mut self, key: &str)
Remove cell by key
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Row
impl Send for Row
impl Sync for Row
impl Unpin for Row
impl UnwindSafe for Row
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more