Rust Study Projects

Composed single-file programs that combine several lessons into one working tool. Read the spec, open the source in the code viewer, then build it yourself before peeking at the answer.

Each project ties together what you learned across multiple phases — structs with impl, collections, error handling, and the standard library. Compile any of them with rustc and run them from the command line.

1. TODO List CLI

A tiny command-line task list: a struct holding a Vec<String>, an impl block with add/list, and std::env::args to parse commands.

Build it on your own, then compare with the reference source.

2. Word Frequency Counter

Reads all of stdin, splits it into words, and counts each one with a HashMap and entry().or_insert(), then sorts by count descending.

Run echo "the rust book" | ./wordcount and see the reference source.

3. mini-grep

A simplified grep: takes a query and a file path, reads the file with std::fs, and prints every matching line with its number — exercising Result and clean error messages.

Study the reference source after your own attempt.

Practice move: extend each project — add a done command to the TODO list, make the word counter ignore case, or give mini-grep a --case-insensitive flag.