Enter your book access code

The curriculum, drills, tutor, and interviewer mode are for readers of Ace the Rust Interview. The code is printed in the Preface (Companion site access).

Don’t have the book yet? The landing page stays open — purchase unlocks this gym.

beginner · order 50

Mixed borrow drill (timed)

borrow-drill-01Related book chapters: 6 (optional — this page is complete on its own)mixed

Slug: borrow-drill-01 · Paired reading: Chapter 6

Prompt

fn grow_if_short(v: &mut Vec<String>, min: usize, filler: &str) — while v.len() < min, push filler.to_owned(). Demonstrates exclusive borrow of v with a shared borrow of filler (different data — OK).