Module in other file



examples/modules/module-in-file/src/main.rs
fn main() {
    println!("in main");

    // crate::tools::private_helper(); // private function

    tools::public_helper();
    crate::tools::public_helper();
}


mod tools;

examples/modules/module-in-file/src/tools.rs
fn private_helper() {
    println!("in tools::private_helper");
}


pub fn public_helper() {
    println!("in tools::public_helper");

    private_helper();
}

in main
in tools::public_helper
in tools::private_helper
in tools::public_helper
in tools::private_helper