Rust provides us with a lot of flexibility in terms of how we organize our project, as we saw in Chapter 2, Managing Projects with Cargo. Here, we'll go into some of the advanced aspects of modules and different ways to introduce more privacy in our code.
Modules, paths, and imports
Imports
We can do nested imports of items from modules. This helps in reducing the taken up by imports. Consider the following code:
// nested_imports.rs
use std::sync::{Mutex, Arc, mpsc::channel};
fn main() {
let (tx, rx) = channel();
}
Re-exports
Re-exports allows one to selectively...