Files
typst/vendor/csv/examples/cookbook-read-basic.rs
2024-10-16 14:18:46 +03:00

21 lines
549 B
Rust

use std::{error::Error, io, process};
fn example() -> Result<(), Box<dyn Error>> {
// Build the CSV reader and iterate over each record.
let mut rdr = csv::Reader::from_reader(io::stdin());
for result in rdr.records() {
// The iterator yields Result<StringRecord, Error>, so we check the
// error here..
let record = result?;
println!("{:?}", record);
}
Ok(())
}
fn main() {
if let Err(err) = example() {
println!("error running example: {}", err);
process::exit(1);
}
}