July 2025
Intermediate to advanced
304 pages
8h 6m
English
Virtually all programming languages have features that allow code to be divided into groups of items. So far, all the code examples that we have seen have used a flat namespace. In this chapter we will look at Rust’s powerful module system and how you can use it to structure your crates.
In Rust, a module is a container for holding items. An item is a component of a crate such as a function, struct, enum, or type (there are others, but let’s just worry about these for now). We have already used modules from the standard library when we imported the Display ...
Read now
Unlock full access