I just discovered that, while in
main.rs I can do:
mylibs is the name of a module directory. But, from every other file in my project, including another file right next to it in the same directory, say
notmain.rs, I must do:
This seems like an odd exception. I read through the docs, and the changes from Rust 2015 to 2018, which seems to confirm what I'm thinking.
I've never seen this explicitly said, though:
main.rs (and maybe
lib.rs) act differently from all other files in a package / crate. Is this correct? (If this is the case, I may just forgo the
mylibs "namespacing" because
crate:: communicates the same concept: that this is local code. At least, it does this in non-
main.rs files. (!?)
It seems that, except for in
main.rs, these paths are interpreted as relative. (?)
EDIT: Another exception I think I found:
moddeclaration is required in
main.rsbut not in other files.