this post was submitted on 08 Nov 2023
13 points (88.2% liked)
Rust
6028 readers
1 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Yes, I like your explanations and I agree that's the way to think about it. But either way you have some special exceptions because
main.rs
maps tocrate
instead of tocrate::main
, anda/mod.rs
maps tocrate::a
instead of tocrate::a::mod
. I know that's the same thing you said, but I think it's worth emphasizing that the very first file you work with is one of the exceptions which makes it harder to see the general rule. It works just the way it should; but I sympathize with anyone getting started who hasn't internalized the special and general rules yet.