Common Collection Methods
We've now learned about the three most common collection types in Rust: Vec, String, and HashMap. While each has its own specific use case, they share a common foundation through the Iterator trait. This means they have a rich set of methods for performing common operations like sorting, filtering, and mapping. In this article, we'll explore some of these useful methods.
Project: Modeling a User Account
It's time to put everything we've learned about structs into practice. In this project, we will model a user account for a web application. This will involve defining a User struct, creating instances of it, and defining methods to interact with the user data.
Project: Rectangle Area Calculator (Part 2)
In Part 1 of this project, we wrote a program that calculates the area of a rectangle using a standalone function. This works, but we can make the code clearer and more organized. The area function is directly related to the Rectangle struct, so it should be a method of the struct.