typeover
rust curriculum

Curriculum Production Rust Smart pointers exercise 3 · mcq

Smart pointers

A value needs to be SHARED by ownership ACROSS THREADS. Pick the smart pointer.

TypeScript reference
Pick the idiomatic Go translation

About this theme

Smart pointers encode ownership strategies in types. This theme covers Box<T> for heap allocation and recursive types, Rc<T> for shared single-thread ownership, and Arc<T> for shared thread-safe ownership. Planned exercises: 1. choose Box for recursive data. 2. recognise shared ownership with Rc. 3. choose Arc across threads. 4. fill Box::new. 5. fill Rc::clone. 6. write a boxed enum node. 7. write shared ownership without cloning the inner value. 8. translate TS shared object references. 9. fix a type whose size would otherwise be infinite.