What is the difference between mod and use

mod defines a code namespace, while use imports items from that namespace into the current scope.

The mod keyword defines a module to organize code into a namespace, while the use keyword brings specific items from that module into the current scope so you can reference them without their full path.

mod my_module {
    pub fn helper() { /* ... */ }
}

use my_module::helper;

fn main() {
    helper(); // No need to write my_module::helper
}