Crate quick_csv [] [src]

Quick Csv reader which performs very well.

Example

First, create a Csv from a BufRead reader, a file or a string

extern crate quick_csv;
 
fn main() {
    let data = "a,b\r\nc,d\r\ne,f";
    let csv = quick_csv::Csv::from_string(data);
    for row in csv.into_iter() {
        // work on csv row ...
        if let Ok(_) = row {
            println!("new row!");
        } else {
            println!("cannot read next line");
        }
    }
}

Row is on the other hand provides 3 methods to access csv columns: - columns: - iterator over columns. - Iterator item is a &str, which means you only have to parse() it to the needed type and you're done

  let mut cols = row.columns().expect("cannot convert to utf8");
  let fifth = cols.nth(5).unwrap().parse::<f64>().unwrap();
  println!("Doubled fifth column: {}", fifth * 2.0);

Modules

columns

Column management module

error

Error management module

Structs

Csv

Csv reader

Row

Row struct used as Csv iterator Item