1 use std::{io, process}; 2 main()3fn main() { 4 let mut rdr = csv::Reader::from_reader(io::stdin()); 5 for result in rdr.records() { 6 // Examine our Result. 7 // If there was no problem, print the record. 8 // Otherwise, print the error message and quit the program. 9 match result { 10 Ok(record) => println!("{:?}", record), 11 Err(err) => { 12 println!("error reading CSV from <stdin>: {}", err); 13 process::exit(1); 14 } 15 } 16 } 17 } 18