Modules and Crates
Last updated
What is Modules and Crates?
Modules provide namespacing and encapsulation within a crate, organizing code with mod keyword and controlling visibility with pub. Crates are compilation units (binaries or libraries) that can depend on other crates. The module system organizes code within crates, while crates enable sharing functionality between projects.
Free resources to learn Modules and Crates
- Official docsCrates
- Official docsManaging Growing Projects with Packages, Crates, and Modules
- ArticleHow It Works: Rust's Module System Finally Explained
More in stage 4: Modules & Crates
Modules and Crates: common questions
Can I learn Modules and Crates in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Modules and Crates in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Modules and Crates tutorial for beginners?
It is lesson 20 of 122 in the free Rust roadmap, in stage 4, Modules & Crates. If you are new to Rust, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.