I don't really know Rust yet, but I have a project that I want to contain a bunch of small Rust programs with a file of a few functions that can be used in all the programs.
I can't seem to get it to be able to see the utils.rs
file with this specific structure.
directory tree:
rust_stuff
|
|_ Cargo.lock
|_ Cargo.toml
|_ src/
| |_ bin/
| |_ project1.rs
| |_ project2.rs
| |_ ...more projects...
|
|_ utils.rs // file of functions to use in all programs
In project1.rs
I have tried use crate::utils;
and also use utils::func1;
and neither seems to be able to find it. Also, the functions in utils.rs
are public. And I've tried a mod.rs
file containing pub mod utils;
and that didn't seem to do anything.
Is it possible to have this structure? If so, what am I doing wrong?