I'm creating an application in Rust. The problem is that I cannot import a module inside lib.rs
file and I wonder how am I supposed to do that.
My folder structure looks like this:
src/
├─ lib.rs
├─ main.rs
├─ app.rs
Inside main.rs
file I use mod lib
to use the library's public functions. But inside lib.rs
file I would like to get the public methods from app.rs
file, but unlike in other files, I cannot because of a compiler error:
file not found for module `app`
help: to create the module `app`, create file "src\lib\app.rs" or "src\lib\app\mod.rs"rustc(E0583)
Strangely enough, when I move the app.rs
file to newly created lib/app.rs
, the compiler would like to find the file in the previous location, which is src/app.rs
, nor src/lib/app.rs
. It gives me a headache.
Thank you for your answers.