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 YouTube
Description
šŸ“¦ 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 tutorials

Duration

8:45

Published

December 23, 2025

Added to Codegiz

March 15, 2026

Open in YouTube