Struct CsvFile

Source
pub struct CsvFile { /* private fields */ }
Expand description

CSV File

CSV file manupulation for Rust Lang.

Implementations§

Source§

impl CsvFile

Source

pub fn new() -> Self

New

New Instance of CSV file.

Source

pub fn heads(&self) -> &Vec<String>

Heads

Get headers.

Source

pub fn head_pos(&self, name: &str) -> Option<usize>

Head Pos

Head position

Source

pub fn rows(&self) -> &Vec<Vec<String>>

Rows

Get rows.

Source

pub fn cols(&self, name: &str) -> Option<Vec<String>>

Cols

Get all the columns.

Source

pub fn row(&self, position: usize) -> Option<&Vec<String>>

Row

Get the row.

Source

pub fn cell(&self, row: usize, col: usize) -> Option<&String>

Cell

Get the cell.

Source§

impl CsvFile

Source

pub fn push_head(&mut self, name: &str)

Push Head

Push new head.

Source

pub fn set_head(&mut self, position: usize, name: &str)

Set Head

Set head to target position.

Source

pub fn insert_head(&mut self, position: usize, name: &str)

Insert Head

Insert new head.

Source

pub fn delete_head(&mut self, position: usize) -> String

Delete Head

Source

pub fn pop_head(&mut self) -> Option<String>

Pop Head

Source

pub fn push_col(&mut self, row: usize, value: &str)

Push Col

Push new column.

Source

pub fn set_col(&mut self, row: usize, col: usize, value: &str)

Set Col

Set column to target position.

Source

pub fn insert_col(&mut self, row: usize, position: usize, value: &str)

Insert Col

Insert new column.

Source

pub fn delete_col(&mut self, position: usize)

Delete Col

Delete all columns.

Source

pub fn pop_col(&mut self)

Pop Col

Pop all columns.

Source

pub fn push_row(&mut self, value: &[&str])

Push Row

Push new row.

Source

pub fn set_row(&mut self, position: usize, value: &[&str])

Set Row

Set row to target position.

Source

pub fn insert_row(&mut self, position: usize, value: &[&str])

Insert Row

Insert new row.

Source

pub fn delete_row(&mut self, position: usize) -> Option<Vec<String>>

Delete Row

Source

pub fn pop_row(&mut self) -> Option<Vec<String>>

Pop Row

Source§

impl CsvFile

Source

pub fn read<P: AsRef<Path>>(path: P) -> Result<CsvFile, Error>

Read

Read CSV file.

Source

pub fn write<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>

Write

Write CSV file.

Trait Implementations§

Source§

impl Debug for CsvFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CsvFile

Source§

fn default() -> CsvFile

Returns the “default value” for a type. Read more
Source§

impl Display for CsvFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.