Skip to content

Ownership practice problems in Rust

Difficulty:
Category:
Tag:

Showing 41 of 41

Status Title Difficulty
Borrowing through Option Medium
Borrow it or own it: your first lifetime decision Easy
Capstone: an ownership-only job scheduler Hard
Clone: explicit, deep, and never free Easy
Conditional moves and drop flags Hard
Copy: the types that don't move Easy
C strings, ownership across the boundary, and FFI-safe types Medium
Designing signatures: T, &T, &mut T, impl Into<T> Medium
Drop order is specified Medium
drop(x) is just a function Easy
E0509: a Drop type is an atom Hard
Enum state machines with data-carrying transitions Hard
Field init shorthand and struct update syntax Easy
Giving ownership back Medium
Grouping without itertools: anagram buckets Medium
Implementing `Vec` part 2: `insert`, `remove`, `Deref`, `IntoIter` Hard
iter, iter_mut, into_iter: all three, one Vec Easy
Joining owned strings Easy
Leaking is safe Hard
Method receivers and the consuming builder Medium
Move or borrow: the two ways to pass a value Easy
Move semantics: the relay Easy
move: when the closure must own its captures Medium
Moving out of &mut: take, replace, swap Medium
mpsc channels: message passing basics Easy
Mutating an Option in place Medium
&mut: exclusive access, and why `mut` appears twice Easy
Ownership inside loops Medium
Ownership through function calls Easy
Partial moves: taking one field and leaving the rest Medium
peekable and next_if: write a tokeniser Hard
`ptr::read`, `write`, `copy`, `copy_nonoverlapping`, `drop_in_place` Medium
Reading E0382 line by line Easy
Shadowing is not moving Easy
Stack, heap, and what a variable actually holds Easy
String vs &str, part 2: functions that take and return text Medium
Structs: naming your data Easy
The drop(tx) hang: a bug with no diagnostics Medium
The owner is frozen too: E0503, E0505, E0506 Medium
The stack, the heap, and `Box<T>` Easy
The three rules of ownership Easy