Rust

Rust Practice

Learn Rust by building the parts of a real library app: integer arithmetic and formatting, borrowed slices and iteration, vectors that dedupe and tally, and a builder that composes them without copying the caller's data.

rustRust
Module 1

Values, Control Flow & Vectors

Learn how to do integer arithmetic and formatting, write control flow as expressions, iterate over borrowed slices, and build vectors that deduplicate and tally.

4
About this challenge

Turn raw seconds into the durations the library screen needs: m:ss with padded seconds and no minute cap, a split into hours and minutes, and a mean length rounded half-up.

About this challenge

Separate a brand-new track from one the user plays daily with an if / else if expression, and collect the titles that clear a rating floor and have been played at least once.

About this challenge

Collapse the sidebar's duplicate albums into one sorted list, and total each artist's plays into one pair per artist in first-appearance order.

About this challenge

Generate a road-trip playlist from the library inside a time limit: qualifying tracks in order, skipped ones recorded, new-track suggestions, the labelled total, the mean length, the albums, the per-artist plays and the listen-level counts.

Module 2

Functions, Text & Options

Learn how to count characters and bytes in borrowed text, use Option for input that may not parse, align output with format width, and compose functions into one command.

4
About this challenge

Count a borrowed text's lines, words and characters, keeping the character count right on UTF-8 that is wider than one byte.

About this challenge

Read the tool's flags into a given Settings struct, defaulting to all three counts and returning None for an unknown flag or a --top without a usable number.

About this challenge

Render the tool's count and ranked word rows with format! width and alignment, never cutting a value that is wider than its column.

About this challenge

Build the whole word-count command: the selected counts in a fixed order, a ranked list of the most frequent lowercased words after a blank line, and a usage line for bad arguments.

Module 3

Custom Types

Learn how to define a struct with an impl block, an enum whose values carry no data, a struct that owns a Vec and lends its contents out, and how to compose them into one rendered board.

4
About this challenge

Define the task tracker's own Task type and give it an associated function that owns a borrowed title, a method that renders its label, and a method that marks it finished.

About this challenge

Define a Priority enum for the task tracker's three urgency levels, parse it from a word of any case into an Option, and give each level its name and its ordering weight.

About this challenge

Define a TaskList struct that owns a vector of tasks with their priorities and answers how many there are, how many are done, how many minutes are left, and which to show first.

About this challenge

Render a whole task tracker as the text the terminal prints: a header counting the tasks, the finished ones and the minutes left, then one padded line per task from the most urgent down.

Frequently asked questions

4

What will I practice in this path?

3 modules: Values, Control Flow & Vectors, Functions, Text & Options and Custom Types.

How many challenges are there, and how hard are they?

12 challenges, all easy.

What does this path run on?

Challenges run on Rust.

Do I need to install anything?

No. Every challenge runs in a browser-based IDE with everything already set up, and your code is graded automatically against a test suite.

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.

Rust Practice: 12 Hands-On Challenges | Staffcoder