I'm trying to properly organize a crate, and hence am using modules put in different folders and files.
The crate structure is as this (took me a day to understand how it works godarnit):
➜ mod_test git:(master) ✗ tree . ├── Cargo.lock ├── Cargo.toml └── src ├── lib.rs ├── side_app │ ├── subapp1.rs │ └── subapp2.rs └── side_app.rs 2 directories, 6 files
where I declare
mod side_app; in
lib.rs, and all items are public.
What's puzzling me is that the
side_app.rs file is completely useless to my opinion: its content is (entirely):
pub mod subapp1; pub mod subapp2;
and hence serves as a "
pub mod listing" of every module located in the (first level of the) branch of the same name. I would rather call directly the two subapp modules in
Cannot the compiler recursively search into the crate structure to find the declared modules?
If not, why?