Skip to content

implement: src/file_io -- std::fs reading CSV, serde for JSON #5

@BryanChasko

Description

@BryanChasko

topic: file i/o

reading and writing files, parsing structured data.

concepts to demonstrate

  • std::fs::read_to_string, File::open
  • BufReader for line-by-line reading
  • csv crate for typed CSV deserialization into structs
  • serde_json for reading/writing JSON
  • proper error propagation with ? and anyhow

patriots theme

read datasets/roster_2004.csv into a Vec<Player>.
write a filtered stats summary to output/rushing_leaders.json.

files

src/file_io/read_roster.rs
src/file_io/write_summary.rs

reference

python mirror: basic_example_working_with_files_players.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions