csv
A fast and flexible CSV reader and writer for Rust, with support for Serde.
Dual-licensed under MIT or the UNLICENSE.
Documentation
https://docs.rs/csv
If you're new to Rust, the tutorial is a good place to start.
Usage
Add this to your Cargo.toml
:
[]
= "1"
and this to your crate root:
extern crate csv;
Example
This example shows how to read CSV data from stdin and print each record to stdout.
There are more examples in the cookbook.
extern crate csv;
use Error;
use io;
use process;
The above example can be run like so:
$ git clone git://github.com/BurntSushi/rust-csv
$ cd rust-csv
$ cargo run --example cookbook-read-basic < examples/data/smallpop.csv
Example with Serde
This example shows how to read CSV data from stdin into your own custom struct. By default, the member names of the struct are matched with the values in the header record of your CSV data.
extern crate csv;
extern crate serde_derive;
use Error;
use io;
use process;
The above example can be run like so:
$ git clone git://github.com/BurntSushi/rust-csv
$ cd rust-csv
$ cargo run --example cookbook-read-serde < examples/data/smallpop.csv