Skip to content
Tutorials Center
My learning

Topics

Lesson 131 of 132 ยท Practice and Review

Rust Interview Questions and Answers

52 common Rust interview questions with concise answers and runnable code: ownership, lifetimes, traits, errors, iterators, Rc and Arc, Send and Sync, async, unsafe.

Rust interviews test one thing above all: whether you understand why the compiler says no. Anyone can memorize "one mutable reference at a time"; strong candidates explain which bug that rule prevents, what the alternative would cost, and how they would restructure code to satisfy it. This page collects 52 questions that come up again and again for backend, systems and infrastructure roles, grouped by topic, each with a short, accurate answer you can expand in your own words.

How to use it: cover the answer, say yours aloud in two or three sentences, then compare. Where a question has a runnable example, change it and predict the result before you press Run. The questions get harder within each group. For hands-on practice see the fundamentals problems and the advanced problems; for quick lookups use the cheat sheet.

Language basics

1. What problem does Rust solve, and how?

Rust gives you the control and speed of C and C++ (no garbage collector, no runtime, predictable memory layout) with memory safety and thread safety checked at compile time. Ownership, borrowing and lifetimes let the compiler prove that there are no use-after-free bugs, no dangling pointers, no double frees and no data races in safe code. The price is a stricter compiler and a learning curve; the reward is that whole categories of bugs cannot be compiled.

2. What is the difference between let, let mut, const and static?

let creates an immutable binding (it cannot be reassigned), let mut a mutable one. const is an inlined compile-time constant that must have a type annotation and a constant expression; it has no fixed address. static is a single memory location that lives for the whole program; static mut is unsafe to touch because it can race. Shadowing (let x = x + 1;) creates a new variable, may change the type, and is not mutation.

3. What is the difference between String and &str?

String is an owned, growable, heap-allocated UTF-8 buffer (pointer, length, capacity). &str is a borrowed view of UTF-8 bytes (pointer and length) that can point into a String, a literal in the binary, or part of either. Functions should usually take &str so callers can pass either; they return String when they create new text. len() counts bytes, and slicing at a position that is not a character boundary panics.

4. What are () and !?

() is the unit type with exactly one value, also written (). Functions without a return type return it, and a block whose last statement ends with a semicolon evaluates to it. ! is the never type: the type of expressions that never produce a value, like panic!(), return, loop {} without break, or std::process::exit(). It coerces to every other type, which is why let n: u32 = match s { Some(v) => v, None => return }; compiles.

5. What happens on integer overflow?

In a debug build, overflow panics (attempt to add with overflow). In a release build, the default is two's-complement wrapping, but that is a profile setting (overflow-checks), not a language guarantee you should rely on. Say what you mean instead: checked_add returns an Option, wrapping_add wraps, saturating_add clamps and overflowing_add returns the value plus a flag. Casts with as truncate silently, so prefer u8::try_from(x) when the value might not fit. See Overflow.

6. What is the difference between an expression and a statement?

An expression evaluates to a value; a statement does not. In Rust almost everything is an expression: if, match, blocks and loop (with break value). A block's value is its last expression without a semicolon. Adding a semicolon turns it into a statement and makes the block evaluate to (), which is a classic cause of error[E0308]: mismatched types with the label "remove this semicolon to return this value".

7. What are editions?

An edition (2015, 2018, 2021, 2024) is an opt-in set of language changes that may break old syntax, chosen per crate in Cargo.toml. Crates of different editions compile together and call each other, because editions only affect the front end of the compiler. They let Rust evolve without a "Rust 2.0" split. Edition 2024 added things such as let chains in if and while and stricter rules for unsafe.

Ownership and borrowing

8. State the ownership rules.

Every value has exactly one owner; when the owner goes out of scope the value is dropped; and ownership can be moved to another owner, after which the old name is unusable. This gives deterministic cleanup (RAII) without a garbage collector. See Ownership.

Rust Moves and drop order

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

9. What is the difference between move, Copy and Clone?

A move transfers ownership and invalidates the source (a bitwise copy of the value's stack part, nothing is duplicated on the heap). Copy types (integers, floats, bool, char, shared references, tuples and arrays of Copy types) are implicitly duplicated on assignment because a bitwise copy is a complete copy; a Copy type can never implement Drop. Clone is an explicit .clone() that may do arbitrary work such as allocating a new buffer. Copy requires Clone. See Copy and Clone.

10. In what order are values dropped?

Local variables are dropped in reverse order of declaration when the scope ends. Struct fields are dropped in declaration order after the struct's own Drop::drop. A moved-from variable is not dropped again. Temporaries are dropped at the end of the statement that created them (with the exceptions of lifetime extension for let x = &temp();). You cannot call drop (the trait method) yourself; use std::mem::drop(value), which simply takes ownership and ends its scope.

11. State the borrowing rules and the bugs they prevent.

At any moment you can have either any number of shared references (&T) or exactly one mutable reference (&mut T), and every reference must be valid for as long as it is used. Together they rule out data races (one writer, many readers) and iterator invalidation: a vector may reallocate on push, so no one may hold a reference into it at the time.

Rust A reference outliving a push (fails on purpose)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

The compiler reports error[E0502]: cannot borrow scores as mutable because it is also borrowed as immutable, pointing at the &scores[0] borrow, the push, and the later println! use. Copy the number out (let first = scores[0];) or finish using the reference first.

12. What are non-lexical lifetimes (NLL)?

Before 2018 a borrow lasted until the end of its lexical block. With NLL, a borrow lasts only until its last use. So let r = &mut v; r.push(1); v.push(2); compiles, because r is not used after the first push. NLL is why many programs that looked impossible in older tutorials just work today. See Non-Lexical Lifetimes.

13. How does Rust prevent dangling references?

Every reference carries a lifetime, and the borrow checker verifies that the data outlives every reference to it. let r; { let x = 5; r = &x; } println!("{r}"); fails with error[E0597]: x does not live long enough. The check happens at compile time and costs nothing at run time.

14. What is a slice?

A slice (&[T], &str, &mut [T]) is a borrowed view of a contiguous run of elements: a pointer plus a length (a "fat pointer", 16 bytes on 64-bit). Slices let functions work on arrays, vectors and parts of them uniformly, and indexing is bounds-checked. &v[1..3] borrows v, so v cannot be changed while the slice is alive.

15. Why does let first = names[0]; fail for a Vec<String>?

Indexing yields a place expression of type String; assigning it would move the string out of the vector and leave a hole, which Rust forbids (E0507: cannot move out of index of Vec``). Choose what you mean: borrow &names[0], clone names[0].clone(), or remove the element with remove, swap_remove or into_iter(). mem::take(&mut names[0]) replaces it with an empty default.

Lifetimes

16. What is a lifetime, and does it exist at run time?

A lifetime is a name for the region of code in which a reference is valid. Lifetimes exist only at compile time; they are erased and have no run-time representation or cost. A lifetime annotation never extends how long data lives. It only describes relationships so that the compiler can check them, for example "the returned reference is valid no longer than the input".

17. What are the lifetime elision rules?

If you leave lifetimes out of a function signature, the compiler applies three rules: (1) each reference parameter gets its own lifetime; (2) if there is exactly one input lifetime, it is given to all output references; (3) if one parameter is &self or &mut self, its lifetime is given to all output references. When the rules cannot decide you get E0106: missing lifetime specifier.

Rust
fn first_word(s: &str) -> &str { s.split(' ').next().unwrap_or("") } // rule 2
fn longest<'a>(a: &'a str, b: &'a str) -> &'a str { if a.len() >= b.len() { a } else { b } } // needed

18. What does 'static mean?

&'static T is a reference that is valid for the entire program, like a string literal. T: 'static as a bound is weaker: it means the type contains no non-'static references, so it may be kept as long as you like. Owned data such as String or Vec<i32> satisfies T: 'static. This is why thread::spawn requires a 'static closure: it cannot borrow from the caller's stack.

19. How do you store a reference in a struct?

Give the struct a lifetime parameter: struct Parser<'a> { text: &'a str }. The compiler then guarantees that a Parser cannot outlive the text it points to. If the struct needs to outlive the source or be sent across threads, store an owned String instead (or use Arc<str>). References in structs are a good fit for short-lived views such as tokenizers and iterators. See Lifetime Patterns.

Traits and generics

20. What is a trait, and what is the orphan rule?

A trait defines shared behaviour: required methods, optional default methods and associated types or constants. Types implement traits, and generic code is written against them. The orphan rule (coherence) says you may implement a trait for a type only if the trait or the type is defined in your crate. That prevents two crates from giving conflicting implementations. The workaround for foreign-on-foreign is a newtype: struct Wrapper(Vec<String>);.

21. What is the difference between static and dynamic dispatch?

Generics and impl Trait use static dispatch: the compiler generates a specialised copy of the function for each concrete type (monomorphization), calls can be inlined, and there is no run-time lookup. dyn Trait uses dynamic dispatch: a reference or box becomes a fat pointer (data pointer plus vtable pointer) and each method call is an indirect call. Static is faster but can grow the binary; dynamic allows heterogeneous collections and keeps compile times down.

Rust Static and dynamic dispatch side by side

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

22. Which traits can be made into trait objects?

A trait is dyn compatible (formerly "object safe") when the compiler can build a vtable for it. Methods that return Self, take Self by value in a way that needs the size, or have generic type parameters are not callable on dyn Trait. You can exclude such methods with where Self: Sized and keep the rest usable. Clone is the classic non-dyn-compatible trait (fn clone(&self) -> Self). Since Rust 1.86 you can also upcast &dyn Sub to &dyn Super.

23. When do you use impl Trait and when generics with bounds?

In argument position, fn f(x: impl Display) is shorthand for a generic parameter; use the explicit fn f<T: Display>(x: T) form when you need to name the type, relate two parameters (a: T, b: T) or use the turbofish. In return position, -> impl Iterator<Item = u32> hides one concrete type that the function chooses; the caller cannot pick it, and it must be a single type (use Box<dyn Trait> to return different types from different branches).

24. What is an associated type, and how is it different from a generic parameter?

An associated type (type Item; in Iterator) is chosen once per implementing type: a type has exactly one Item. A generic parameter on the trait (trait Add<Rhs>) allows several implementations for the same type (Vec2 + Vec2 and Vec2 * f64 can coexist). Use an associated type when there is one natural answer, which also keeps signatures short (I: Iterator<Item = u32>).

25. What is monomorphization and what does it cost?

For each distinct set of concrete types a generic function is used with, the compiler emits a separate specialised function. The result has no run-time overhead, which is what "zero-cost abstraction" means, but more code: longer compile times and bigger binaries. Techniques to limit the cost: make the generic function a thin wrapper that calls a non-generic inner function, or use dyn Trait on cold paths.

26. What is deref coercion?

When you pass &T where &U is expected and T: Deref<Target = U>, the compiler inserts the dereferences for you. This is why &String works as &str, &Vec<T> as &[T], and &Box<T> as &T. It happens at function arguments and method calls, and is the reason to take &str and &[T] in signatures. See Smart Pointers.

27. Why is f64 not Ord?

NaN is not equal to itself and is not comparable to anything, so floats only get PartialEq and PartialOrd. Without Eq/Ord you cannot use floats as HashMap keys or call sort() or max() directly. Use sort_by(|a, b| a.total_cmp(b)) (a total order that sorts NaN last), or partial_cmp if you want to handle NaN yourself.

Rust Sorting floats

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

Implement From<T> for U and you get Into<U> for T for free through a blanket implementation, so implement From, not Into. From must not fail; use TryFrom for fallible conversions. From also powers the ? operator, which calls From::from on the error. See Display and From.

Enums, errors and patterns

29. How does Rust handle null?

It has no null references. A value that may be absent is an Option<T> (Some(v) or None), and the compiler forces you to deal with None before using the inside. Option<&T> and Option<Box<T>> use a niche so they take no more space than the plain pointer. This removes the "billion-dollar mistake" from safe code. See Option.

30. When do you use Result and when panic!?

Use Result for failures a caller could reasonably handle (file missing, bad input, network down). Use panic! (and assert!, unreachable!, indexing) for bugs: broken invariants and situations that should be impossible. Libraries should almost never panic on user input. unwrap() and expect("why this cannot fail") are fine in tests, prototypes, and when you have just proved success; expect documents the assumption.

31. How does the ? operator work?

On Result, expr? evaluates to the Ok value, or returns early with Err(From::from(e)). On Option it returns None early. It works only in functions whose return type can absorb the failure (Result, Option, or main returning Result). The From::from call is what lets different error types funnel into one, for example io::Error and ParseIntError into Box<dyn Error> or your own enum.

32. What does a panic do?

By default a panic unwinds the stack of the panicking thread, running Drop for each value on the way, and then ends the thread; if it is the main thread, the process exits with code 101. Other threads are unaffected, and join() returns Err for the panicked one. With panic = "abort" in the profile the process aborts at once with no unwinding (smaller binaries, no cleanup). A lock held during a panic becomes poisoned, so later lock() calls return an Err that you can recover from with into_inner().

33. Why must match be exhaustive, and what are let else and if let chains?

Exhaustiveness means the compiler lists any variant you forgot (E0004). This turns "add a new enum variant" into a to-do list of compile errors. if let handles one pattern, let Some(x) = opt else { return; }; (let-else, Rust 1.65) binds or diverges so the happy path stays unindented, and if let Some(x) = a && x > 3 (let chains, edition 2024, Rust 1.88) combines patterns and conditions. See Patterns.

34. How would you design the error type of a library?

A dedicated enum with one variant per failure kind, implementing Display and std::error::Error (with source() for the underlying cause) and From impls so that ? works. Callers can then match on the cause. For applications that only need to report errors, Box<dyn Error> or the anyhow crate is simpler. The thiserror crate generates the boilerplate for the library case. See Custom Errors and Error Design.

Collections, iterators and closures

35. What is the difference between iter(), iter_mut() and into_iter()?

iter() yields &T (shared borrows), iter_mut() yields &mut T, and into_iter() yields T and consumes the collection. For for x in v Rust calls into_iter() on whatever v is, so for x in &v borrows and for x in v moves the vector. Keep that in mind when a vector "disappears" after a loop.

36. What does it mean that iterators are lazy?

Adapters such as map, filter and take only build a new iterator; nothing runs until a consumer (collect, sum, for, count, next) pulls values. Then each element flows through the whole chain one at a time, so no intermediate collections are created, and short-circuiting adapters can stop early. The optimiser usually compiles the chain into a loop as fast as a hand-written one.

Rust Laziness and short-circuiting

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

37. What are Fn, FnMut and FnOnce?

They describe how a closure uses what it captures. Fn only reads, so it can be called repeatedly and concurrently. FnMut mutates captured state, so it needs &mut access. FnOnce consumes a captured value, so it can be called one time only. Every closure implements FnOnce; closures that never move out also implement FnMut; those that never mutate implement Fn. Accept the weakest bound you need (FnOnce is the most permissive for callers). move forces capture by value but does not change which trait is implemented.

38. How does HashMap work, and why is its order random?

It is a hash table (SwissTable) using SipHash 1-3 by default, with a random key per map to resist hash-flooding attacks, so iteration order differs between runs and even between maps. If you need ordering use BTreeMap, or sort the keys. Swap the hasher (BuildHasher) for speed when the keys are trusted. The entry API (*map.entry(k).or_insert(0) += 1) does the lookup once. See HashMap and Random and Hashing.

39. What is the difference between a Vec's length and capacity?

Length is how many elements it holds; capacity is how many fit before the buffer must be reallocated. push is amortized O(1): when full, the buffer grows (by a factor, which is unspecified but geometric in practice) and the elements move, which is why references into a vector cannot survive a push. Use Vec::with_capacity(n) when you know the size to avoid repeated reallocation. See Vec.

40. When do you use Box<dyn Fn> and when impl Fn?

impl Fn(..) in argument position or as a return type is static: one concrete closure type, no allocation, can be inlined. Box<dyn Fn(..)> is needed when you must store several different closures in one collection or field, or return different closures from different branches; it costs an allocation and an indirect call. Function pointers (fn(i32) -> i32) work when the closure captures nothing.

Smart pointers and memory

41. When do you use Box<T>?

When you need a value on the heap with a single owner: for recursive types (enum List { Cons(i32, Box<List>), Nil } would otherwise have infinite size), for large values you want to move cheaply, and for trait objects (Box<dyn Trait>). It is a plain owning pointer with no overhead beyond the allocation and it drops its contents when it goes out of scope.

42. What is the difference between Rc and Arc, and how do cycles leak?

Both give shared ownership by reference counting; the value is dropped when the last owner goes away. Rc uses plain counters (cheap, single thread, not Send); Arc uses atomic counters (thread-safe, slightly slower). Neither lets you mutate through the shared handle without RefCell/Mutex. If two values hold Rcs to each other the counts never reach zero and the memory leaks; break the cycle with Weak, a non-owning reference that you upgrade() to an Option<Rc<T>>.

Rust Strong and weak counts

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

43. What is interior mutability?

Mutating data through a shared reference, with the borrow rules enforced differently. Cell<T> copies values in and out (no references to the inside). RefCell<T> hands out Ref/RefMut guards and checks at run time: breaking the rules (two borrow_mut() at once) panics. Mutex and RwLock do the same across threads by blocking. Use it sparingly; most programs should be able to pass &mut. See RefCell and Cell.

44. What is Cow?

Cow<'a, T> ("clone on write") is an enum that is either Borrowed(&'a T) or Owned(T::Owned). A function returning Cow<str> can hand back the input unchanged without allocating in the common case, and allocate a new String only when it actually changes something. It is a good fit for escaping, normalising and path handling. See Cow and Borrow.

45. How is memory laid out for a struct, and what is repr(C)?

By default Rust may reorder fields and add padding to minimise size, so the layout is unspecified. #[repr(C)] fixes C's layout (declaration order, C padding rules) for FFI; #[repr(transparent)] guarantees a single-field wrapper has the same layout as its field; #[repr(u8)] fixes an enum's discriminant size. Option<Box<T>> is the same size as Box<T> thanks to the null niche. See Memory Layout.

Concurrency and async

46. What are Send and Sync?

They are auto traits that describe thread safety. T: Send means ownership of a T can move to another thread. T: Sync means &T can be shared between threads (equivalently, &T is Send). Rc is neither (its counter is not atomic), RefCell and Cell are Send but not Sync, and Arc<T> is both when T is Send + Sync. thread::spawn requires Send and the compiler enforces it.

Rust Rc cannot cross threads (fails on purpose)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

The compiler stops with error[E0277]: `Rc<i32>` cannot be sent between threads safely and the note that the trait Send is not implemented for Rc<i32>. Replacing Rc with Arc fixes it. See Send and Sync.

47. How do you share mutable state between threads?

Wrap it in Arc<Mutex<T>> (or RwLock for many readers, or atomics for single counters): Arc gives each thread an owner, Mutex makes access exclusive, and the guard returned by lock() unlocks on drop. Keep critical sections short and never hold a lock across a slow operation. Often better: avoid sharing, and give each thread its own data, then combine results through join or a channel.

Rust Arc and Mutex across threads

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

48. Why does thread::spawn need move, and what are scoped threads?

A spawned thread can outlive the function that created it, so its closure must be 'static: it cannot borrow locals. move transfers ownership of the captured variables into the closure. thread::scope guarantees that all threads spawned in the scope are joined before it returns, so those threads can borrow local data, which removes many Arc clones. See Threads.

49. Channels or shared state?

Channels (mpsc) transfer ownership of messages between threads, which avoids sharing and makes data flow easy to reason about (workers, pipelines, fan-in). Shared state with Mutex suits a small amount of data many threads update, like counters and caches. Rust allows both safely; neither is universally better. Whatever you choose, make the result independent of scheduling order. See Channels.

50. What is a Future, and why does async fn do nothing until awaited?

A Future is a value with a poll method that either returns Poll::Ready(value) or Poll::Pending after arranging to be woken later. An async fn compiles into a state machine that implements Future; calling it only builds that value without running any code. An executor (from a crate such as Tokio) polls futures, and .await suspends the current future until the awaited one completes, letting the executor run others on the same thread.

Rust A future is lazy until polled

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with io::stdin().read_line()), it gets the next line from this box.

Waker::noop() (Rust 1.85) exists for tests like this; real programs use an executor. A common async pitfall: calling blocking code (thread::sleep, heavy CPU work, blocking I/O) inside an async task stalls the executor thread. Move it to a blocking thread pool. See Async Introduction and Futures by Hand.

Unsafe and tooling

51. What does unsafe allow, and what does it not?

unsafe unlocks five abilities: dereferencing raw pointers, calling unsafe functions (including foreign ones), accessing or modifying a mutable static, implementing an unsafe trait (like Send), and reading union fields. It does not turn off the borrow checker or other checks; ordinary references are still checked. The idiom is to keep unsafe blocks small, document the invariant in a // SAFETY: comment, and wrap them in a safe API that cannot be misused. Undefined behaviour in an unsafe block can break the safe code around it. See Unsafe Rust.

Rust
let x = 7_u32;
let p = &x as *const u32;
// SAFETY: p points to the live local `x`, properly aligned and initialised.
let y = unsafe { *p };

52. What do Cargo, clippy and rustfmt do?

Cargo is the build system and package manager: it resolves dependencies from crates.io (recorded in Cargo.lock), compiles with cargo build/run/test, and manages features and workspaces. rustfmt (cargo fmt) formats code in the standard style. clippy (cargo clippy) runs hundreds of lints that catch common mistakes and non-idiomatic code. Teams run all three in CI. See Cargo and Projects and Clippy and rustfmt.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Which statement about lifetimes is true?

    Lifetimes are checked at compile time and have no run-time representation. They do not extend how long anything lives, and elision means you often do not have to write them.
  2. 2. What is the main difference between Rc<T> and Arc<T>?

    Both share ownership by reference counting. Arc's counters are atomic, so it is Send and Sync (for suitable T); Rc is cheaper but cannot cross threads, and the compiler enforces this with E0277.
  3. 3. Why does thread::spawn(|| println!("{name}")) fail when name is a local String?

    A spawned thread needs a 'static closure. Borrowing name ties the closure to the caller's stack frame (E0373), so move the String into the closure (or use thread::scope).
  4. 4. What happens when you call an async fn but never await or poll the returned future?

    An async fn returns a lazy state machine. Its body only runs when an executor polls it, usually through .await.
  5. 5. What does unsafe NOT do?

    Unsafe adds a few extra abilities; it does not switch off type checking or borrow checking of normal references. You promise to uphold the invariants the compiler cannot verify.

Summary

  • Ownership gives deterministic cleanup; borrowing is "many readers or one writer"; lifetimes are compile-time labels, not run-time data.
  • Know Copy versus Clone versus move, drop order (reverse of declaration), and why Vec references cannot survive a push.
  • Static dispatch (generics, impl Trait) is monomorphized and fast; dyn Trait is one copy plus a vtable.
  • Use Option and Result instead of null and exceptions, propagate with ?, and reserve panic! for bugs.
  • Iterators are lazy and compile to tight loops; closures are Fn, FnMut or FnOnce depending on how they use their captures.
  • Rc, RefCell, Arc and Mutex cover shared ownership and mutation; Send and Sync let the compiler police threads; futures are lazy state machines driven by an executor.
  • unsafe adds five abilities and a duty to document and encapsulate them.

That completes the Rust tutorial. To keep going, build something real with the projects, skim the cheat sheet before your interview, and read the standard library tour and the advanced chapters whenever a question leads you deeper.