1 use std::error::Error; 2 use std::io; 3 use std::process; 4 run() -> Result<u64, Box<dyn Error>>5fn run() -> Result<u64, Box<dyn Error>> { 6 let mut rdr = csv::Reader::from_reader(io::stdin()); 7 let mut record = csv::ByteRecord::new(); 8 9 let mut count = 0; 10 while rdr.read_byte_record(&mut record)? { 11 if &record[0] == b"us" && &record[3] == b"MA" { 12 count += 1; 13 } 14 } 15 Ok(count) 16 } 17 main()18fn main() { 19 match run() { 20 Ok(count) => { 21 println!("{}", count); 22 } 23 Err(err) => { 24 println!("{}", err); 25 process::exit(1); 26 } 27 } 28 } 29