3 ms·
There is a mistake in the screenshots: filesystem view doesn't show `mod.rs`. To all others struggling with Rust's module system, it may seem unnatural if you'
by Fiahil 6y ago
There is a mistake in the screenshots: filesystem view doesn't show `mod.rs`.
To all others struggling with Rust's module system, it may seem unnatural if you're coming from another language (like python), but once you finally understand how it's wired it will be as simple as python's.
Consider `mod.rs` like `__init__.py`, with the added benefit of being capable of renaming and choosing when to expose internal module components.
- Rusky 6y agoI think that was intentional? Or at least, `mod.rs` is explicitly added later on in the article.
- rkwz 6y ago> There is a mistake in the screenshots: filesystem view doesn't show `mod.rs`. Yes, didn't realize it would be confusing. I've fixed the diagrams in examples 2 & 3 to include mod.rs in filesystem tree :)
- StavrosK 6y ago> Consider `mod.rs` like `__init__.py`, with the added benefit of being capable of renaming and choosing when to expose internal module components. That's exactly what __init__.py does too, though.