rust-unofficial / patterns

A catalogue of Rust design patterns, anti-patterns and idioms
https://rust-unofficial.github.io/patterns/
Mozilla Public License 2.0
8.02k stars 367 forks source link

Module/code organization #212

Open fade2black opened 3 years ago

fade2black commented 3 years ago

cargo new already creates a structured project (folders, etc...). Wouldn't be it nice to create a section/page/idioms/ devoted to best practices of code organisation? For example how to struct modules, crates, workspaces...how to refer one crate from another or one module from another. What do you think?

MarcoIeni commented 3 years ago

Do you mean cargo new, right? We could cover the use of mod.rs, because if I remember correctly the rust book doesn't cover that

fade2black commented 3 years ago

@MarcoIeni Yeah, right,cargo, fixed. 😊

simonsan commented 3 years ago

Good post about it: https://www.sheshbabu.com/posts/rust-module-system/

MarcoIeni commented 3 years ago

Should this be an idiom?

simonsan commented 3 years ago

We could also include a example using cargo generate