Project structure is as -
and foo.rs is as-
pub mod Foo {
pub fn work() {
println!("Test executed.");
}
}
main.rs is simple as -
fn main() {
println!("Hello, world!");
}
now how to call work
function in main
function?
I have tried with -
- use crates::modals::Foo; not working
- adding mod.rs in modals not working
- adding modals.rs at main.rs level not working
What are the right and simple ways to do this?