Struct dcsv::VirtualArray
source · [−]Expand description
Virtual data which contains csv information in a form of arrays.
VirtualArray holds row information as vectors. Therefore indexing is generally faster than virtual data struct. VirtualArray doesn’t allow limiters. Values in VirtualArray can be indexed only with colum index.
VirtualArray has two variables which are
- columns
- rows
Fields
columns: Vec<String>rows: Vec<Vec<String>>Implementations
sourceimpl VirtualArray
impl VirtualArray
sourcepub fn set_cell(&mut self, x: usize, y: usize, value: &str) -> DcsvResult<()>
pub fn set_cell(&mut self, x: usize, y: usize, value: &str) -> DcsvResult<()>
Set cell’s value with given string value
sourcepub fn move_row(
&mut self,
src_index: usize,
target_index: usize
) -> DcsvResult<()>
pub fn move_row(
&mut self,
src_index: usize,
target_index: usize
) -> DcsvResult<()>
Move given row to a target row index
sourcepub fn move_column(
&mut self,
src_index: usize,
target_index: usize
) -> DcsvResult<()>
pub fn move_column(
&mut self,
src_index: usize,
target_index: usize
) -> DcsvResult<()>
Move a given column to target column index
sourcepub fn rename_column(
&mut self,
column_index: usize,
new_name: &str
) -> DcsvResult<()>
pub fn rename_column(
&mut self,
column_index: usize,
new_name: &str
) -> DcsvResult<()>
Rename a column
This will simply change the name of the column and doesn’t affect rows.
sourcepub fn set_column(&mut self, column_index: usize, value: &str) -> DcsvResult<()>
pub fn set_column(&mut self, column_index: usize, value: &str) -> DcsvResult<()>
Set values to a column
Given value will override every row’s value
sourcepub fn edit_row(
&mut self,
row_index: usize,
values: Vec<Option<&str>>
) -> DcsvResult<()>
pub fn edit_row(
&mut self,
row_index: usize,
values: Vec<Option<&str>>
) -> DcsvResult<()>
Edit a row
Only edit row’s cell when value is not none
sourcepub fn set_row(&mut self, row_index: usize, values: &[&str]) -> DcsvResult<()>
pub fn set_row(&mut self, row_index: usize, values: &[&str]) -> DcsvResult<()>
Set values to a row
sourcepub fn insert_row<T: AsRef<str>>(
&mut self,
row_index: usize,
source: Option<&[T]>
) -> DcsvResult<()>
pub fn insert_row<T: AsRef<str>>(
&mut self,
row_index: usize,
source: Option<&[T]>
) -> DcsvResult<()>
Insert a row to given index
This can yield out of range error
sourcepub fn delete_row(&mut self, row_index: usize)
pub fn delete_row(&mut self, row_index: usize)
Delete a row with given row_index
This doesn’t fail but silently do nothing if index is out of range
sourcepub fn insert_column(
&mut self,
column_index: usize,
column_name: &str,
placeholder: Option<&str>
) -> DcsvResult<()>
pub fn insert_column(
&mut self,
column_index: usize,
column_name: &str,
placeholder: Option<&str>
) -> DcsvResult<()>
Insert a column with given column informations
- column_index : Position to put column
- column_name : New column name
sourcepub fn delete_column(&mut self, column_index: usize) -> DcsvResult<()>
pub fn delete_column(&mut self, column_index: usize) -> DcsvResult<()>
Delete a column with given column index
sourcepub fn get_row_count(&self) -> usize
pub fn get_row_count(&self) -> usize
Get total rows count
sourcepub fn get_column_count(&self) -> usize
pub fn get_column_count(&self) -> usize
Get total columns count
Trait Implementations
sourceimpl Default for VirtualArray
impl Default for VirtualArray
Auto Trait Implementations
impl RefUnwindSafe for VirtualArray
impl Send for VirtualArray
impl Sync for VirtualArray
impl Unpin for VirtualArray
impl UnwindSafe for VirtualArray
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