EN | DE

Stage 10.7: Creating Modules

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 file mod.rs inside
Rust mascot Ferris