Modules: hierarchically split and manage visibility

Rust provides a powerful module system that can be used to hierarchically split code in logical units (modules), and manage visibility (public/private) between them.

A module is a collection of items:

  • functions
  • structs
  • traits
  • impl blocks,
  • and even other modules.