6 More collections, more error handling

This chapter covers

  • Other collections—more complex and interesting ones this time
  • The question mark operator—just type ? to handle errors
  • When panic and unwrap are good

Rust has a lot more collection types than the ones we learned in chapter 3. You might not need all of them right away, but be sure to give each collection type a read so that you’ll remember when you might need each one of them. This chapter also introduces one of Rust’s most loved operators: ? (Yes, it’s just a question mark.)

6.1 Other collections

Rust has many more types of collections besides the ones we learned in chapter 3. All of them are contained in the same spot: the std::collections module in the standard library. The best way ...

Get Learn Rust in a Month of Lunches now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.