Skip to content

Latest commit

 

History

History
29 lines (17 loc) · 662 Bytes

README.md

File metadata and controls

29 lines (17 loc) · 662 Bytes

Expanded Rust

Overview

  • We get to see a lot of the code getting abstracted away in the Rust standard library using macros.

Example

So, here we can see that the println! macro is expanded to the std::io::_print function with the format_args! macro.

This is a very small eg, but you can definitely see how the code gets abstracted away for large codebases.

Installation

$ cargo install cargo-expand

Usage

Inside a project directory with a Cargo.toml file, run:

$ cargo expand > expanded.rs

You will obtain a expanded.rs file in the project root directory.