Files
book/src/ch20-00-advanced-features.md
Chris Krycho 38b2b8537f infra: dprint, part 2
- Reformat everything now that the bug in dprint for wrapping lines with
  inline code is fixed.
- Additionally, apply the formatting rules I *should have* applied the
  first time, so the repo has the same style it has historically used.
2024-12-05 14:05:53 -07:00

1.2 KiB
Raw Permalink Blame History

Advanced Features

By now, youve learned the most commonly used parts of the Rust programming language. Before we do one more project in Chapter 21, well look at a few aspects of the language you might run into every once in a while, but may not use every day. You can use this chapter as a reference for when you encounter any unknowns. The features covered here are useful in very specific situations. Although you might not reach for them often, we want to make sure you have a grasp of all the features Rust has to offer.

In this chapter, well cover:

  • Unsafe Rust: how to opt out of some of Rusts guarantees and take responsibility for manually upholding those guarantees
  • Advanced traits: associated types, default type parameters, fully qualified syntax, supertraits, and the newtype pattern in relation to traits
  • Advanced types: more about the newtype pattern, type aliases, the never type, and dynamically sized types
  • Advanced functions and closures: function pointers and returning closures
  • Macros: ways to define code that defines more code at compile time

Its a panoply of Rust features with something for everyone! Lets dive in!