
📎 This article includes 2 downloadable practice files ↓
Put sales.csv next to Cargo.toml, use the lesson file as src/main.rs and run cargo run --release. It totals sales by region, skipping bad rows with a message instead of crashing.
Next steps
- Use the
csvandserdecrates to parse into structs with quoted fields handled properly. - Accept the file name as a command-line argument (
std::env::argsor theclapcrate). - Write the summary to a new CSV.
That’s the Rust course, and the last of the beginner courses.
Code for this course follows standard, current syntax; we test JavaScript and PowerShell scripts before publishing, and R/Java/Rust examples are kept to core language features. Tell us if anything fails on your setup.
Practice
Build and run the tool, then add a product summary.
📎 Practice files for this article
- 📄rust-csv-summary-main.rsLesson code file.⬇ RS · 1 KB
- 🧾sales.csv40 sample orders used by the scripts.⬇ CSV · 1 KB
Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.
Stuck on a step? Ask a question and the AI answers using this article.