All This Fruit!

For this topic, we will start by learning about structs, short for structures. structs give us a way to create new types and to combine logically related data. This is a great launch point for introducing one of the most core concepts in all of Rust: ownership. Ownership is a Really Big Deal in Rust, and we’re just going to get our feet wet in this lesson.

One thing to know about this topic, you’re going to see a lot of annoying ways of doing things. Don’t worry, this is not the True Rust Way. For now, we will be setting up some pain points so that in later lessons, we can learn the real solutions to these problems.

Let’s say I sell fruit. I need to know how many apples and bananas I have. Since I’m a Rustacean, I write a program to tell me:

Get hands-on with 1400+ tech skills courses.