Skip to content

GuillaumeGomez/csv-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

csv-parser

A CSV parser written in Rust with nom.

##HOWTO

This library provides 3 functions:

  • parse_csv
  • parse_csv_from_file
  • parse_csv_from_slice

They all return a Result containing a vector of vector. The first line of the vector contains each column name.

##Examples

A short one:

use csv_parser;

fn main() {
    let csv_to_parse = "\"nom\",age\ncarles,30\nlaure,28\n";
    if let Ok(parsed_csv) = parse_csv(csv_to_parse) {
        // and we're all good!
    }
}

You can give a file path as well:

use csv_parser;

fn main() {
    let csv_file = "some_file.csv";
    if let Ok(parsed_csv) = parse_csv_from_file(csv_file) {
        // and we're all good!
    }
}

About

A CSV parser written in Rust with nom

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages