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
Tags: #modules
Share on Facebook Share on Twitter Share on Reddit Save on Pocket Share on LinkedIn Share via email
Rust mascot Ferris