1 use std::collections::HashMap; 2 use std::{error::Error, io, process}; 3 4 // This introduces a type alias so that we can conveniently reference our 5 // record type. 6 type Record = HashMap<String, String>; 7 run() -> Result<(), Box<dyn Error>>8fn run() -> Result<(), Box<dyn Error>> { 9 let mut rdr = csv::Reader::from_reader(io::stdin()); 10 for result in rdr.deserialize() { 11 let record: Record = result?; 12 println!("{:?}", record); 13 } 14 Ok(()) 15 } 16 main()17fn main() { 18 if let Err(err) = run() { 19 println!("{}", err); 20 process::exit(1); 21 } 22 } 23