mirror of
https://github.com/darkicewolf50/RustBrock.git
synced 2025-06-15 04:54:17 -06:00
1.1 KiB
1.1 KiB
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: A feature of Cargo that allows you to build, test and share crates
- Crates: A tree of modules that produces a library or an executable
- Modules and use: lets you control the organization, scope and privacy of paths
- Paths: A way of naming an item, such as a struct, function or module