Rust 1.46.0
04488afe3

# Crates and Modules

There is a new edition of the book and this is an old link.

> Rust has a module system that enables the reuse of code in an organized fashion. A module is a namespace that contains definitions of functions or types, and you can choose whether those definitions are visible outside their module (public) or not (private).

> A crate is a project that other people can pull into their projects as a dependency.

    mod network {
        fn connect() {
        }
    }

Run

Here are the relevant sections in the new and old books:

- in the current edition: Ch 7.01 — `mod` and the Filesystem
- in the current edition: Ch 14.02 — Publishing a Crate to Crates.io
- In the first edition: Ch 3.25 — Crates and Modules