quest

Sign in to start training

quest keeps your progress, streaks, and scores tied to your account — so you can pick up on any device.

Synced everywhere. Progress follows you across laptop and phone.
Streaks & stats. See your daily run and every score over time.
Your profile. A name and avatar for the work you do here.

We only use Google to sign you in and sync progress. No posting, no contacts — ever.

Borrow checker Advanced

26  Moving out

You can't move a value out from behind a reference -- that would leave a hole. The fix is to swap something valid into its place and hand back the old value. std gives you take for exactly this.

Step 2 / 2

Fix Slot::take: take the item out of &mut self, leaving None behind.

Hints
  • Option::take does exactly this: self.item.take().
26_move_out.rs
Reset to starterCompiled in a sandbox; hidden checks must pass.
Reveal solution
struct Slot { item: Option<String> }

impl Slot {
    fn take(&mut self) -> Option<String> {
        self.item.take()
    }
}