Others

There are many more macros. We have already used some of them, such as the cfg!() and vec![] macros. You can also cause an explicit compile error with the compile_error!("message") macro, or use the file!(), line!(), and column!() macros to get the current position in the code, or even the module_path!() macro to get the current module.

If you want to know more, open the standard library documentation by running rustup doc --open and check out the rest of the macros there.

Get Rust High Performance 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.