Complete these tasks to reinforce what you learned in this module.
Assume a CSV file has a header row and a numeric column (e.g. value). Read the file path from the first CLI argument, deserialize each row into a struct with at least value: i32 (and any other columns you need). Sum the value column and print the total.
value field and derive Deserialize; use csv::Reader::from_path and iterate over deserialize() to get rows. Add each row’s value to a running sum.// Task 1: Read CSV and sum a column. See tasks/TASKS.md.
fn main() {
todo!("Read CSV from CLI arg, deserialize, sum value column");
}
In code, create a Vec of at least two structs (e.g. { id: 1, name: "Alice" }, { id: 2, name: "Bob" }). Write them to output.csv with a header row using csv::Writer and serialize. Print "Wrote output.csv" when done.
Serialize. Use csv::Writer::from_path; write the header row first, then serialize each struct. Don’t forget to flush.// Task 2: Write CSV from a list. See tasks/TASKS.md.
fn main() {
todo!("Create Vec of structs, write to output.csv with csv::Writer");
}