• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use std::error::Error;
2 use std::io;
3 use std::process;
4 
main()5 fn main() {
6     if let Err(err) = run() {
7         println!("{}", err);
8         process::exit(1);
9     }
10 }
11 
run() -> Result<(), Box<dyn Error>>12 fn run() -> Result<(), Box<dyn Error>> {
13     let mut rdr = csv::Reader::from_reader(io::stdin());
14     for result in rdr.records() {
15         // This is effectively the same code as our `match` in the
16         // previous example. In other words, `?` is syntactic sugar.
17         let record = result?;
18         println!("{:?}", record);
19     }
20     Ok(())
21 }
22