ABSTRACT

This chapter discusses packages and crates, defining modules, paths for referring, and how to separate modules into different files. Modules allow us to group code within a crate for easier reading and reuse. Modules also manage item privacy, which determines whether an item can be utilized by outside code (public) or is an internal implementation detail that isn't accessible to the public (private). Modules are used to arrange our code in the same way directories are used in a filesystem. Modules are useful for more than just structuring our code. They also define Rust's privacy border, which is the line that contains the implementation details that external code is not allowed to know about, call, or rely on in Rust.