If you use both styles for the same module, youβll get a compiler error. Using a mix of both styles for different modules in the same project is allowed, but might be confusing for people navigating your project.
The main downside to the style that uses files named mod.rs is that your project can end up with many files named mod.rs, which can get confusing when you have them open in your editor at the same time.
Maidsafe currently uses a mix of both styles. Do you mind @maidsafe if I made a PR to switch to preferred module naming?
Iβd say we go with the modern approach? (Iβm not sure whatβs expected eg in the client/src/chunks we have mod but importing the other filesβ¦ is that chunks.rs and chunks/error.rs ? or is that still a mod?)
It makes no difference to me wrt the maidsafe crates. So this is just a general comment about rust file layouts.
I personally dislike having chunks.rs exist outside the chunks directory, effectively splitting chunks module logic into two levels. While having duplicate mod.rs open in my editor is annoying, I still prefer it to breaking up the logic for the chunks module into two separate directories.
oh, Iβm not saying it is possible with todayβs rust compiler. afaik, the compiler only accepts the two styles you originally mentioned. I am just ranting that I think the βnew styleβ was a step backwards for the compiler/lang, and couldβve been done the way Iβm suggesting instead.
So now devs are forced to choose lesser of two evils, instead of a clearly non-evil option. (my opinion).