rust-lang / rust-lang/rustlings

Feature Request: File I/O Exercises in Rustlings

Open
#2,233 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
64.2k
Forks
11.3k
Avg merge
5h 24m
Merged PRs (30d)
2

Description

Description

Add a new category (24_file_io/) focused on file operations, a crucial skill for Rust developers currently missing from Rustlings.

Proposed Exercises

  1. Basic File Reading (file_io1.rs)

    • Teaches using fs::read_to_string and handling file not found errors
    • Includes input file with text content to read
    • Tests verifying correct content parsing
  2. Buffered Reading & Writing (file_io2.rs)

    • Demonstrates efficient reading with BufReader and writing with BufWriter
    • Processes a large input file line by line
    • Writes transformed content to an output file
    • Tests verifying correct transformation
  3. Path Manipulation & Metadata (file_io3.rs)

    • Works with Path and PathBuf to handle file paths safely
    • Extracts and manipulates file metadata (creation time, size, permissions)
    • Tests verifying correct metadata extraction

Implementation Structure

  • Each exercise includes a Rust file and associated input/output files
  • Files are embedded and available during testing
  • All exercises follow Rustlings patterns with TODO comments and progressive difficulty

Questions

  1. Is handling extra files (inputs/outputs) compatible with current Rustlings structure?
  2. Any specific file I/O patterns you'd prefer to prioritize?

I'm happy to draft sample implementations if this proposal is of interest.

cc @mo8it

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing Rustlings exercise structure and how its tests and embedded files are handled. Then assess whether a new 24_file_io/ category can support file_io1.rs, file_io2.rs, file_io3.rs and their input/output files. Done means the structure is agreed and the three progressive exercises have tests for the described file operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.