Search⌘ K

Move Out!

Explore how to work with Rust structs and ownership rules by modifying functions to return struct values. Understand the implications of moving data and prepare to use references for better code practices in future lessons.

We'll cover the following...

We moved the Fruit value into the count_fruit function. Let’s move it back out by using a return type! Up until now, we’ve implicitly been returning a () unit value. Instead, let’s return the Fruit value ...