Feature Request: File I/O Exercises in Rustlings

Aperta
#2,233 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
rust
Ambito
tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Rust
Stelle
64.6k
Fork
11.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-lang/rustlings

Tutte le issue di rust-lang/rustlings

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.