Rust Modules & Crates Tutorial | Organize Your Rust Code with mod, pub, use | Rust for Beginners #29
95views
2likes
1comments
8:45
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
š¦ Learn how to organize your Rust code with modules and crates!
In this tutorial, you'll master Rust's module system - the key to writing clean, maintainable Rust projects. We'll cover everything from declaring modules to using the powerful standard library.
ā±ļø TIMESTAMPS
0:00 - Introduction
0:30 - Module Basics (mod & pub)
3:02 - The use Keyword & Aliasing
5:20 - Standard Library Modules (HashMap, HashSet)
8:17 - Wrap Up & Next Steps
š WHAT YOU'LL LEARN
ā
Declaring modules with the mod keyword
ā
Public vs private visibility with pub
ā
Nested modules for better organization
ā
The use keyword for cleaner imports
ā
Aliasing with "as" to avoid conflicts
ā
Using std::collections (HashMap, HashSet)
ā
Working with environment variables
š» CODE EXAMPLES COVERED
⢠mod greetings { pub fn hello() { } }
⢠use math_utils::add;
⢠use formatting::format_number as fmt;
⢠use std::collections::HashMap;
⢠use std::collections::HashSet;
š¦ RUST TUTORIAL SERIES
This is Lesson 29 in our comprehensive Rust programming series for beginners. Perfect for developers coming from other languages who want to learn Rust's unique approach to code organization.
š PREREQUISITES
⢠Basic Rust syntax (variables, functions, structs)
⢠Understanding of iterators and closures (helpful but not required)
š RESOURCES
⢠Rust Book - Modules: https://doc.rust-lang.org/book/ch07-00-managing-growing-projects-with-packages-crates-and-modules.html
⢠std::collections docs: https://doc.rust-lang.org/std/collections/
š If this helped you understand Rust modules, please LIKE and SUBSCRIBE for more Rust tutorials!
šÆ NEXT UP: Lesson 30 - Cargo Deep Dive (dependencies, Cargo.toml, publishing)
#Rust #RustLang #Programming #Tutorial #Modules #Crates #CodingTutorial #LearnRust #RustForBeginners
Back to tutorialsOpen in YouTube
Duration
8:45
Published
December 23, 2025
Added to Codegiz
March 15, 2026