Struct dcsv::VirtualArray
source · pub struct VirtualArray {
pub metas: Vec<Meta>,
pub columns: Vec<Column>,
pub rows: Vec<Vec<Value>>,
}Expand description
Virtual array 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 allows duplicate columns
- VirtualArray doesn’t allow limiters.
Fields§
§metas: Vec<Meta>§columns: Vec<Column>§rows: Vec<Vec<Value>>Implementations§
source§impl VirtualArray
impl VirtualArray
sourcepub fn get_column_iterator(
&self,
column_index: usize
) -> DcsvResult<IntoIter<&Value>>
pub fn get_column_iterator( &self, column_index: usize ) -> DcsvResult<IntoIter<&Value>>
Get iterator of a column with given index
Trait Implementations§
source§impl Clone for VirtualArray
impl Clone for VirtualArray
source§fn clone(&self) -> VirtualArray
fn clone(&self) -> VirtualArray
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Default for VirtualArray
impl Default for VirtualArray
source§impl Display for VirtualArray
impl Display for VirtualArray
to_string implementation for virtual array
This returns csv value string
source§impl VCont for VirtualArray
impl VCont for VirtualArray
source§fn rename_column(
&mut self,
column_index: usize,
new_name: &str
) -> DcsvResult<()>
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.
source§fn set_column(&mut self, column_index: usize, value: Value) -> DcsvResult<()>
fn set_column(&mut self, column_index: usize, value: Value) -> DcsvResult<()>
Set values to a column
Given value will override every row’s value
source§fn edit_row(
&mut self,
row_index: usize,
values: &[Option<Value>]
) -> DcsvResult<()>
fn edit_row( &mut self, row_index: usize, values: &[Option<Value>] ) -> DcsvResult<()>
Edit a row
Only edit row’s cell when value is not none
source§fn insert_row(
&mut self,
row_index: usize,
source: Option<&[Value]>
) -> DcsvResult<()>
fn insert_row( &mut self, row_index: usize, source: Option<&[Value]> ) -> DcsvResult<()>
Insert a row to given index
This can yield out of range error
source§fn delete_row(&mut self, row_index: usize) -> bool
fn delete_row(&mut self, row_index: usize) -> bool
Delete a row with given row_index
This doesn’t fail but silently do nothing if index is out of range
source§fn insert_column(
&mut self,
column_index: usize,
column_name: &str
) -> DcsvResult<()>
fn insert_column( &mut self, column_index: usize, column_name: &str ) -> DcsvResult<()>
Insert a column with given column informations
- column_index : Position to put column
- column_name : New column name
source§fn delete_column(&mut self, column_index: usize) -> DcsvResult<()>
fn delete_column(&mut self, column_index: usize) -> DcsvResult<()>
Delete a column with given column index
source§fn move_column(
&mut self,
src_index: usize,
target_index: usize
) -> DcsvResult<()>
fn move_column( &mut self, src_index: usize, target_index: usize ) -> DcsvResult<()>
Move a given column to target column index
source§fn get_row_count(&self) -> usize
fn get_row_count(&self) -> usize
Get total rows count
source§fn get_column_count(&self) -> usize
fn get_column_count(&self) -> usize
Get total columns count
source§fn set_cell(&mut self, x: usize, y: usize, value: Value) -> DcsvResult<()>
fn set_cell(&mut self, x: usize, y: usize, value: Value) -> DcsvResult<()>
Set cell value by coordinate
source§fn move_row(&mut self, src_index: usize, target_index: usize) -> DcsvResult<()>
fn move_row(&mut self, src_index: usize, target_index: usize) -> DcsvResult<()>
Move a given row to a target row index
source§fn set_row(&mut self, row_index: usize, values: &[Value]) -> DcsvResult<()>
fn set_row(&mut self, row_index: usize, values: &[Value]) -> DcsvResult<()>
Set values to a row Read more
source§fn update_width_global(&mut self)
fn update_width_global(&mut self)
Fully iterate cells to update max_width
fn get_formatted_string( &self, line_delimiter: &str, align_type: CellAlignType ) -> String
source§fn get_string_table(&self, align_type: CellAlignType) -> Vec<Vec<String>>
fn get_string_table(&self, align_type: CellAlignType) -> Vec<Vec<String>>
Get table as raw string table
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§
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