Chooce video playback speed
speed:1
  1. 41
    Rustlings move_semantics3: Specifying that a function argument is mutable
    22s

Rustlings move_semantics3: Specifying that a function argument is mutable

InstructorChris Biscardi

Share this video with your friends

Send Tweet

README for this exercise.

This lesson is a Community Resource

A Community Resource means that it’s free to access for all. The instructor of this lesson requested it to be open to the public.

Chris Biscardi: In move_semantics3, we're supposed to make a compile without adding any new lines and just changing existing ones. In this case, we can't borrow a vec as mutable inside of fill_vec on line 20. In contrast, for the last two move_semantics, we aren't creating a new vec inside of the fill_vec function this time.

If we specify that we want to mutate vec in our type signature, we can then mutate vec and our tests pass.