Skip to content

Feature Request: File I/O Exercises in Rustlings #2233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bluntbrain opened this issue Apr 9, 2025 · 1 comment
Open

Feature Request: File I/O Exercises in Rustlings #2233

bluntbrain opened this issue Apr 9, 2025 · 1 comment

Comments

@bluntbrain
Copy link

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

@bluntbrain
Copy link
Author

Hi @mo8it !
I learned Rust a few months ago using Rustlings and it was incredibly helpful. I'm a big fan of project-based learning and would love to contribute to this repository.

Let me know your thoughts on this proposal or if there are other features you'd like me to work on instead, I have a few hours daily to contribute. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant