mirror of
https://github.com/darkicewolf50/RustBrock.git
synced 2025-06-15 13:04:18 -06:00
21 lines
1.1 KiB
Markdown
21 lines
1.1 KiB
Markdown
# Packages, Modules and Crates
|
|
|
|
Projects should generally group related code/function together this increases code organization
|
|
|
|
packages can contain multiple binary codes/files or a library crate
|
|
|
|
very large projects should be done with interrelated packages that all update should be done using cargo workspaces
|
|
|
|
encapsulation is useful because you don't need to worry about its implementation
|
|
this is good for reusing code
|
|
|
|
rust has features for your code's organization, which parts are exposed, which details are private and what names are in each scope in the program
|
|
|
|
These features are known collectively as the ``module system`` they include
|
|
- [**Packages**](Packages.md): A feature of Cargo that allows you to build, test and share crates
|
|
- [**Crates**](Crates.md): A tree of modules that produces a library or an executable
|
|
- [**Modules** and **use**](Modules%20and%20Use.md): lets you control the organization, scope and privacy of paths
|
|
- [**Paths**](Paths.md): A way of naming an item, such as a struct, function or module
|
|
|
|
## Best Practices for Packages with a Binary and a Library
|