Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust Training Corpus

What do rust companies ask?

For small to mid Rust startups specifically, here is the honest picture.

What they actually test

Rust fundamentals under real conditions is the core. Not textbook questions but applied reasoning:

  • Ownership and borrowing in non-trivial situations — why does this not compile, how would you restructure this
  • Lifetime reasoning — not reciting rules but explaining why a specific lifetime annotation is needed
  • Async Rust — how does the executor model work, what happens when you block inside async, cancellation safety
  • Concurrency primitives — when Arc vs Mutex vs channels, what are the tradeoffs
  • Error handling patterns — anyhow vs thiserror, how you propagate errors across async boundaries

Systems design at this level

Small Rust startups care about systems thinking more than pattern recitation. They might ask you to design a simple job queue, a rate limiter, or a connection pool in Rust specifically — not as an algorithm problem but as a Rust design problem. How do you structure the types, what are the ownership implications, how does async interact with it.

What they almost never do

Leetcode and DSA. A small Rust startup has no dedicated interview infrastructure. They are not running you through HackerRank. They want to know if you can reason about Rust systems problems, not if you can reverse a binary tree.

Your specific profile

The async executor starvation work covers the most likely deep question they would ask. If you can explain the tokio worker thread model, why blocking collapses scheduling, and what the fix looks like — that is the interview for most of these firms.

The weak spot to prepare for is live Rust reasoning under pressure — being given a piece of code with a subtle ownership or lifetime issue and walking through it out loud. That is the one area worth deliberate practice.


This chapter is not a verbatim dump of Rust books or docs. Instead, it is a compact training corpus:

  • what to study
  • where to study it
  • what to rehearse repeatedly
  • what to solve in code

The goal is to treat this as fixed training data for your own mind.

Primary Corpus

1. The Rust Book

Use this for the full language model from first principles.

Focus on:

  • ownership and borrowing
  • structs and enums
  • pattern matching
  • traits and generics
  • lifetimes
  • smart pointers
  • concurrency

Use it as the main conceptual spine.

2. Rust by Example

Use this for quick syntax recall.

Focus on:

  • pattern matching
  • traits
  • generics
  • lifetimes
  • modules
  • error handling
  • iterators
  • unsafe

Use it when you know the concept but need the concrete syntax back.

3. Rustlings

Use this for compiler-guided practice.

Focus on:

  • fixing errors quickly
  • ownership and borrowing drills
  • enums and pattern matching
  • traits and generics
  • lifetimes
  • tests

This is one of the best fluency tools because it forces active recall.

4. Exercism Rust Track

Use this for coding questions and repeated implementation.

Focus on:

  • basic array/string manipulation
  • iterators
  • structs and enums
  • error handling
  • idiomatic function design
  • test-driven completion

This is the best source for “repeat many small Rust coding tasks.”

5. Tokio Tutorial

Use this for practical async Rust.

Focus on:

  • async/.await
  • spawning tasks
  • channels
  • select!
  • synchronization
  • blocking vs non-blocking work

6. Async Book

Use this for the deeper async model.

Focus on:

  • futures as state machines
  • pinning
  • execution model
  • async traits and combinators

Use this after the Tokio tutorial, not before it.

7. Rustonomicon

Use this for unsafe Rust.

Focus on:

  • raw pointers
  • aliasing and validity
  • unsafe contracts
  • FFI
  • safe wrappers around unsafe internals

8. Comprehensive Rust

Use this as a dense structured course when you want a broader systematic pass.

Focus on:

  • language structure
  • traits and generics
  • lifetimes
  • memory model
  • async
  • unsafe

What To Drill Repeatedly

Core language

  • Explain move vs copy vs borrow.
  • Explain String vs &str.
  • Explain Option vs Result.
  • Write a struct, enum, and match from memory.
  • Write methods in an impl.
  • Explain T: Trait vs impl Trait vs dyn Trait.
  • Explain what a lifetime is protecting.

Collections and iteration

  • Use Vec and HashMap naturally.
  • Use iter, iter_mut, and into_iter correctly.
  • Write map, filter, and collect pipelines.
  • Solve small array/string problems without fighting ownership.

Concurrency

  • Explain Arc<Mutex<T>>.
  • Explain Send and Sync.
  • Write a simple channel example.
  • Explain why shared mutable state needs structure.

Async

  • Explain what async fn returns.
  • Explain .await as a suspension point.
  • Explain why futures are state machines.
  • Explain why blocking inside async is dangerous.
  • Explain spawn_blocking.

Unsafe

  • Explain what unsafe does and does not mean.
  • Explain raw pointers.
  • Explain why unsafe code needs explicit invariants.
  • Explain why safe wrappers matter.

Rust Recall Prompts

Use these as oral drills.

  1. What is the difference between ownership and borrowing?
  2. What is the difference between lifetime constraints and access constraints?
  3. Why is String different from &str?
  4. Why does Rust call T a generic type parameter?
  5. Why is Display a trait bound and not a type?
  6. What does match exhaustiveness guarantee?
  7. Why does Some(x) create a binding in pattern matching?
  8. What is the difference between a variable and a binding?
  9. What is the difference between moving a value and dropping a value?
  10. Why does Rust consider &T and &mut T different access modes?
  11. What does Arc<Mutex<T>> mean semantically?
  12. What is the difference between impl Trait and dyn Trait?
  13. Why are futures described as state machines?
  14. Why can blocking code break async systems?
  15. What responsibility shifts back to the engineer in unsafe Rust?

Rust Coding Drills

Repeat these until they are easy from memory.

Basic drills

  • implement two_sum
  • implement binary_search
  • implement max_subarray
  • parse a string into numbers with Result
  • write a struct User with methods
  • write an enum and handle it with match

Intermediate drills

  • write a trait and implement it for two structs
  • write a generic function with a trait bound
  • write a function returning impl Iterator
  • write a borrowed function with explicit lifetimes
  • write a HashMap frequency counter

Async drills

  • write tokio::spawn
  • write tokio::select!
  • write a timeout example
  • write a blocking example and then move it to spawn_blocking
  • write async shared state with Arc<Mutex<T>>

Unsafe drills

  • read through a raw pointer in a tiny example
  • declare one extern "C" function
  • wrap one unsafe operation in a safe function
  • describe the invariant required by that wrapper

Best Training Loop

For each topic:

  1. Read one section from the official source.
  2. Rewrite the concept in your own words.
  3. Write one code example from memory.
  4. Solve one small exercise.
  5. Revisit the same topic after 1 day, 3 days, and 7 days.

What Not To Do

  • Do not collect endless resources.
  • Do not switch formats every hour.
  • Do not only read passively.
  • Do not only watch videos.
  • Do not mistake exposure for mastery.

The Practical Rule

Use a small fixed corpus:

  • Rust Book
  • Rust by Example
  • Rustlings
  • Exercism
  • Tokio tutorial
  • Async Book
  • Rustonomicon
  • this mdBook

Then repeat it until recall is automatic.

Short Framing

I do best when I train from a fixed high-quality corpus and repeat it until the concepts become automatic. For Rust, that means combining the official language model, repeated compiler-driven exercises, practical async work, and unsafe reasoning, instead of collecting endless scattered material.