Skip to content
AgileLogics
Intermediate 5 min read

Intermediate Projects

Prerequisites: Level 2 — Intermediate

Build these using modules, Result-based error handling, traits, iterators, threads, and crates from Level 2.

1. Grep Clone

Build a minigrep-style CLI with clap that searches files for a pattern, with a case-insensitive flag and line numbers. Put the search logic in lib.rs behind a clean function, return a custom error type instead of panicking, and cover the logic with unit tests.

2. JSON-Backed Contact Book

Build a CLI that adds, lists, and deletes contacts, persisting them to a contacts.json file with serde_json. Split the code into modules (storage, contacts, cli) and make every fallible function return Result.

3. Parallel Word Counter

Given a folder of text files, count word frequencies across all of them using std::thread::scope (one thread per file), merge the per-file HashMaps, and print the ten most common words — sorted, so the output is deterministic.

4. Inventory with Traits

Model products of different kinds (books, electronics, groceries) as structs implementing a shared Priced trait with a default discounted_price method, store them as Vec<Box<dyn Priced>>, and report totals using iterator adapters.