Struct dcsv::VirtualData
source · [−]Fields
columns: Vec<Column>rows: Vec<Row>Implementations
sourceimpl VirtualData
impl VirtualData
pub fn new() -> Self
sourcepub fn read_only(&self) -> ReadOnlyData
pub fn read_only(&self) -> ReadOnlyData
Get readly only data from virtual data
This clones every value into a ReadOnlyData. If the purpose is to simply iterate over values, prefer read_only_ref method.
sourcepub fn read_only_ref(&self) -> ReadOnlyDataRef<'_>
pub fn read_only_ref(&self) -> ReadOnlyDataRef<'_>
Get readly only data from virtual data buf as reference
sourcepub fn set_cell_from_string(
&mut self,
x: usize,
y: usize,
value: &str
) -> Result<(), DcsvError>
pub fn set_cell_from_string(
&mut self,
x: usize,
y: usize,
value: &str
) -> Result<(), DcsvError>
Set cell’s value with given string value
sourcepub fn move_row(&mut self, src: usize, target: usize) -> Result<(), DcsvError>
pub fn move_row(&mut self, src: usize, target: usize) -> Result<(), DcsvError>
Move given row to target row number
sourcepub fn move_column(
&mut self,
src: usize,
target: usize
) -> Result<(), DcsvError>
pub fn move_column(
&mut self,
src: usize,
target: usize
) -> Result<(), DcsvError>
Move given column to target column number
sourcepub fn rename_column(
&mut self,
column: &str,
new_name: &str
) -> Result<(), DcsvError>
pub fn rename_column(
&mut self,
column: &str,
new_name: &str
) -> Result<(), DcsvError>
Rename column
Column cannot be a number or exsiting one
sourcepub fn set_column(
&mut self,
column: &str,
value: Value
) -> Result<(), DcsvError>
pub fn set_column(
&mut self,
column: &str,
value: Value
) -> Result<(), DcsvError>
Set values to a column
sourcepub fn edit_row(
&mut self,
row_number: usize,
values: Vec<Option<Value>>
) -> Result<(), DcsvError>
pub fn edit_row(
&mut self,
row_number: usize,
values: Vec<Option<Value>>
) -> Result<(), DcsvError>
Edit a row
Only edit row’s cell when value is not none
sourcepub fn set_row(
&mut self,
row_number: usize,
values: Vec<Value>
) -> Result<(), DcsvError>
pub fn set_row(
&mut self,
row_number: usize,
values: Vec<Value>
) -> Result<(), DcsvError>
Set values to a row
sourcepub fn get_cell(&self, x: usize, y: usize) -> Result<Option<&Value>, DcsvError>
pub fn get_cell(&self, x: usize, y: usize) -> Result<Option<&Value>, DcsvError>
get cell data by coordinate
sourcepub fn set_cell(
&mut self,
x: usize,
y: usize,
value: Value
) -> Result<(), DcsvError>
pub fn set_cell(
&mut self,
x: usize,
y: usize,
value: Value
) -> Result<(), DcsvError>
Set cell value by coordinate
sourcepub fn insert_row(
&mut self,
row_number: usize,
source: Option<&Vec<Value>>
) -> Result<(), DcsvError>
pub fn insert_row(
&mut self,
row_number: usize,
source: Option<&Vec<Value>>
) -> Result<(), DcsvError>
Insert a row to given number
This can yield out of rnage error
sourcepub fn delete_row(&mut self, row_number: usize) -> Option<Row>
pub fn delete_row(&mut self, row_number: usize) -> Option<Row>
Delete a row with given row_number
This doesn’t fail but silent do nothing if number is out of range
sourcepub fn insert_column(
&mut self,
column_number: usize,
column_name: &str,
column_type: ValueType,
limiter: Option<ValueLimiter>,
placeholder: Option<Value>
) -> Result<(), DcsvError>
pub fn insert_column(
&mut self,
column_number: usize,
column_name: &str,
column_type: ValueType,
limiter: Option<ValueLimiter>,
placeholder: Option<Value>
) -> Result<(), DcsvError>
Insert a column with given column information
sourcepub fn delete_column(&mut self, column_number: usize) -> Result<(), DcsvError>
pub fn delete_column(&mut self, column_number: usize) -> Result<(), DcsvError>
Delete a column with given index
sourcepub fn set_limiter(
&mut self,
column: usize,
limiter: &ValueLimiter,
panic: bool
) -> Result<(), DcsvError>
pub fn set_limiter(
&mut self,
column: usize,
limiter: &ValueLimiter,
panic: bool
) -> Result<(), DcsvError>
Set a limiter to a column
sourcepub fn export_schema(&self) -> String
pub fn export_schema(&self) -> String
Export schema as string form
sourcepub fn try_get_column_index(&self, src: &str) -> Option<usize>
pub fn try_get_column_index(&self, src: &str) -> Option<usize>
Get a column index from src
Src can be either colum name or column index If colum index is out of range, it returns none
pub fn get_row_count(&self) -> usize
pub fn get_column_count(&self) -> usize
Trait Implementations
sourceimpl Clone for VirtualData
impl Clone for VirtualData
sourcefn clone(&self) -> VirtualData
fn clone(&self) -> VirtualData
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Display for VirtualData
impl Display for VirtualData
to_string implementation for virtual data
This returns csv value string
sourceimpl From<&'_ VirtualData> for ReadOnlyData
impl From<&'_ VirtualData> for ReadOnlyData
sourcefn from(data: &VirtualData) -> Self
fn from(data: &VirtualData) -> Self
Converts to this type from the input type.
sourceimpl<'data> From<&'data VirtualData> for ReadOnlyDataRef<'data>
impl<'data> From<&'data VirtualData> for ReadOnlyDataRef<'data>
sourcefn from(data: &'data VirtualData) -> Self
fn from(data: &'data VirtualData) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for VirtualData
impl Send for VirtualData
impl Sync for VirtualData
impl Unpin for VirtualData
impl UnwindSafe for VirtualData
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