Modules Definition
-
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
-
When we think of code, we usually imagine a hierarchy of files organized in directories
-
Rust lets you create modules closely related to your file structure
-
There are two ways in Rust to declare a module. For example, a module
foo
can be represented as- a file named
foo.rs
- a directory named
foo
with a filemod.rs
inside
- a file named