Search⌘ K

Methods by Reference

Explore how to use methods by reference in Rust to avoid ownership issues and improve code usability. Understand implicit borrowing in method calls and practice implementing mutable methods to modify data.

We'll cover the following...

Unfortunately, this price method isn’t great. If you remember from before, we ran into problems when we moved the Fruit value into the price_fruit function. When you have a parameter named self, it means “move it into this method.” Fortunately, ...