Rust 语言之旅 目录

[未翻译] Modules

Every Rust program or library is a crate.

Every crate is made of a hierarchy of modules.

Every crate has a root module.

A module can hold global variables, functions, structs, traits or even other modules!

In Rust there is not a 1 to 1 mapping of files to the module tree hierarchy. We must build the module tree explicitly by hand in our code.