Rust Import Module
Suppose we have two files src/main.rs
and src/utils.rs
, to use utils.rs
in main.rs
, there are two ways that work.
Use mod
keyword in main.rs
|
|
Use pub mod
keyword in lib.rs
create a lib.rs
file in src
directory.
|
|
then add this in main.rs
|
|