#![allow(dead_code)] use std::{error::Error, io, process}; use serde::Deserialize; #[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] struct Record { latitude: f64, longitude: f64, #[serde(deserialize_with = "csv::invalid_option")] population: Option, city: String, state: String, } fn run() -> Result<(), Box> { let mut rdr = csv::Reader::from_reader(io::stdin()); for result in rdr.deserialize() { let record: Record = result?; println!("{:?}", record); } Ok(()) } fn main() { if let Err(err) = run() { println!("{}", err); process::exit(1); } }