From the course: Rust for C# Developers
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Modules - Rust Tutorial
From the course: Rust for C# Developers
Modules
- [Instructor] In C# and .NET, we're used to using name spaces, to structure our code in a hierarchical way. This is usually done in a folder structure, which reflects the name of the name spaces. Even if you technically can break this pattern and add name spaces within name spaces in the same file, this is frowned upon in the .NET world. In Rust, the same hierarchical structure of code is done through the concept of modules. It differs a bit from name spaces, but can be used in a very similar way, practically. By convention, from what I've seen in the Rust community, Rust is a lot less strict when it comes to the rules used in C# and .NET with one file, one class, and one folder, one name space. This is probably due to the difference in functionality of Rust modules. The basic syntax for specifying modules in Rust is similar to in C#. The usage of these modules and how to use types and functionality within these modules…