Trait csv_perusal::ParseSeparatedValues

source ·
pub trait ParseSeparatedValues {
    // Required method
    fn get_csv_types(self) -> Result<Vec<Vec<CSVType>>, CSVPerusalError>;
}
Expand description

Contains the method for converting grid data to CSVType.

Required Methods§

source

fn get_csv_types(self) -> Result<Vec<Vec<CSVType>>, CSVPerusalError>

A required method that converts grid data into a two-dimensional vector of CSVType.

§How to Implement
impl ParseSeparatedValues for Vec<Vec<MyCustomEnum>> {
    fn get_csv_types(self) -> Result<Vec<Vec<CSVType>>, CSVPerusalError> {
        // Make sure your input datatype can convert to a string.
        // [`utils::grid_to_byterecord!`] will convert your grid data into Vec<[`csv::ByteRecord`]>.
        let byte_records = grid_to_byterecord!(self);
        // Converts Vec<[`csv::ByteRecord`]> to Vec<Vec<[`CSVType`]>>
        assign_bytes(byte_records)
    }
}

Implementations on Foreign Types§

source§

impl ParseSeparatedValues for Vec<Vec<&str>>

source§

fn get_csv_types(self) -> Result<Vec<Vec<CSVType>>, CSVPerusalError>

Organizes two-dimensional str vector into specific data types via the CSVType struct.

source§

impl ParseSeparatedValues for Vec<Vec<String>>

source§

fn get_csv_types(self) -> Result<Vec<Vec<CSVType>>, CSVPerusalError>

Organizes two-dimensional String vector into specific data types via the CSVType struct.

source§

impl ParseSeparatedValues for Vec<ByteRecord>

source§

fn get_csv_types(self) -> Result<Vec<Vec<CSVType>>, CSVPerusalError>

Organizes csv::ByteRecord into specific data types via the CSVType struct.

Implementors§