File: tutorial-setup-01.rs

package info (click to toggle)
rust-csv 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 6,280 kB
  • sloc: makefile: 6
file content (16 lines) | stat: -rw-r--r-- 602 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Import the standard library's I/O module so we can read from stdin.
use std::io;

// The `main` function is where your program starts executing.
fn main() {
    // Create a CSV parser that reads data from stdin.
    let mut rdr = csv::Reader::from_reader(io::stdin());
    // Loop over each record.
    for result in rdr.records() {
        // An error may occur, so abort the program in an unfriendly way.
        // We will make this more friendly later!
        let record = result.expect("a CSV record");
        // Print a debug version of the record.
        println!("{:?}", record);
    }
}