2 ms·
That's a great explanation! However, it misses the part where modules don't need to be in a separate file, but can also live in a "mod { ... }" block within the
by dbrgn 6y ago
That's a great explanation! However, it misses the part where modules don't need to be in a separate file, but can also live in a "mod { ... }" block within the same file.
- pornel 6y agoI actually like that it omitted the inline syntax. It was the source of my confusion when I read the official Rust Book. Examples with inline syntax don't make it clear that `mod` goes in the parent file (since there's no child file, so you don't have the reference). "But it's the same as if you just put the {} in another file" was like "the proof is trivial, left as an exercise for the reader".