It’s somewhat common to split a large module up into multiple
.rs for internal structure only; these sub-modules are private and any public interfaces are
So I had an interesting idea to make this simpler:
pub(in mod) use mod inner;
As equivalent to:
mod inner; pub(in mod) use self::inner::*;
This then effectively inlines the implementation detail module.
pub(restricted) can still be used and privacy is respected as normal.
Why the new grammar?
After all, it’s only one like shorter anyway.
The reason I think this might be useful is that it clearly marks the module as a transparent implementation detail rather than a structural split. Making this easier also encourages further breaking up large files into smaller pieces. I know that the boilerplate of breaking out a new module solely for internal organization and not external structure delays the point at which I break files up, even with IntelliJ Rust’s automatic module creation.