21 Continuing the tour
This chapter covers
- The
mem
module - The
std
library prelude - Setting panic hooks and viewing backtraces
- Other macros
This is the second of two chapters touring the standard library, with a lot of new (but not difficult) types that you’ll find useful to know. Near the end, we will look at some macros we haven’t encountered before, which will lead into the next chapter, where you will learn how to write your own!
21.1 std::mem
As the name implies, the std::mem
module has types and functions for dealing with memory. The functions inside this module are particularly interesting (and convenient). We have seen some of them already, such as size_of(), size_of_val()
, and drop()
:
use std::mem; fn main() { println!("Size of an ...
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.