patterns icon indicating copy to clipboard operation
patterns copied to clipboard

Module/code organization

Open fade2black opened this issue 5 years ago • 5 comments

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?

fade2black avatar Jan 23 '21 03:01 fade2black

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

marcoieni avatar Jan 23 '21 07:01 marcoieni

@MarcoIeni Yeah, right,cargo, fixed. 😊

fade2black avatar Jan 23 '21 08:01 fade2black

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

simonsan avatar Jan 23 '21 12:01 simonsan

Should this be an idiom?

marcoieni avatar Jan 27 '21 22:01 marcoieni

We could also include a example using cargo generate

simonsan avatar Feb 22 '21 12:02 simonsan