What is the exact set of rules that rust uses to look up a module from a file?
Every explanation I have found online about modules says, "this is the purpose of modules, here is an example of one, ..." None give the complete, comprehensive, 100% accurate explanation for how rust looks up modules. Even the rust reference doesn't tell you whether both the crate root and the importing file need to declare mod! There is no simple ruleset I can use to tell whether it will work.
I'm looking for something I can follow, like:
- Rust looks at the name, parsing
::likesubdir::subdir::name - Rust looks to see if there is a file
name.rsin the same directory andname/mod.rs - There is not allowed to be both a
name.rsand aname/mod.rs. - Then, Rust...???