Home / Code typing practice / Rust
Rust Typing Practice
Free Rust typing practice: type real Rust with references, macros like println!, match arms, closures and derive attributes. Train &, ::, -> and |x| until they flow.
Rust is one of the most demanding languages to type: references with &, paths with ::, return types after ->, closures between pipes |x|, macros ending in ! and attributes like #[derive(Debug)].
The snippets cover String::from, iterator chains with filter and collect, match on a Result, a derived struct and an impl block: the Rust you write in every project.
Rust code you will type
Each session picks from these, in random order. Line breaks are shown as single spaces.
fn main() { let name = String::from("Rose"); println!("Hello, {}!", name); }
let evens: Vec<i32> = nums.iter().filter(|n| *n % 2 == 0).cloned().collect();
match result { Ok(value) => println!("{value}"), Err(e) => eprintln!("error: {e}"), }
#[derive(Debug, Clone)] struct Point { x: f64, y: f64 }
impl Point { fn dist(&self) -> f64 { (self.x * self.x + self.y * self.y).sqrt() } }
Symbols to watch
&::->|!#[ ]=>{ }Not sure which finger to use? See the programming symbols finger chart.
Tips for typing Rust faster
- Closures use pipes: | is Shift and backslash, right little finger.
- Macros end in !: Shift and 1, left little finger with the right Shift.
- -> and => look alike but use different keys: minus then > versus equals then >.
Frequently asked questions
Is Rust hard to type?
It's among the most symbol-heavy languages, so most people are slower on Rust than on Python or Go at first. That makes it excellent practice.
Does Rust practice help with other languages?
Yes. Rust uses nearly every symbol on the keyboard, so it trains reaches you will use in any language.