mirror of
https://github.com/darkicewolf50/RustBrock.git
synced 2025-07-07 19:47:15 -06:00
.gitea
.github
.obsidian
HelloWorld
actix_web_learning
adder
branches
functions_rust
guessing_game
hello-async
hello_cargo
loops
minigrep
ownership
rectangles
.gitignore
Any Number of Futures.md
Applying Async.md
Async, Await, Futures and Streams.md
Cargo Workspaces.md
Cargo and Cratesio.md
Closures.md
Collection of Common Data Structs.md
Concurrency.md
Constants.md
Crates.md
Custome Build Profiles.md
Data Types.md
Deref Trait.md
Drop Trait.md
Enums.md
Error Handling.md
Extending Cargo.md
For later baja.md
Futures and Async.md
Generic Types Traits and Lifetimes.md
Generics.md
Hash.md
Improving The IO Project.md
Install Binaries.md
Iterators and Closures.md
Iterators.md
Leaky Reference Cycles.md
Lifetimes.md
Modules and Use.md
Packages.md
Passing Data Between Threads.md
Paths.md
Primitives.md
Project Organization.md
Publishing libraries.md
README.md
Reducing_Code_Duplication.md
Ref Cell Mutability.md
Reference Counter Smart Pointer.md
RustBrock.code-workspace
Shared State Concurrency.md
Simultaneous Code Running.md
Smart Pointers.md
String.md
Structures.md
Sync and Send.md
Test Controls.md
Test_Organization.md
Tests.md
The Performance Closures and Iterators.md
Traits.md
Using Box on the Heap.md
Variables.md
Vector.md
Writing_Tests.md
data_types.md
ownership.md
34 lines
963 B
Markdown
34 lines
963 B
Markdown
# Packages
|
|
|
|
a bundle of one or more crates that provides a set functionality
|
|
|
|
it contains a cargo.toml file and describes how to build those crates
|
|
|
|
packages can have as many binary crates as you want but only at most one library crate
|
|
|
|
packages must have at least one crate
|
|
|
|
packages are defined by the toml file that comes with creating a new crate
|
|
|
|
# External Packages
|
|
|
|
These crates are normally found on [crates.io](https://crates.io/)
|
|
in the guessing game the external crate was first defined in the cargo.toml as
|
|
```toml
|
|
rand = "0.8.5"
|
|
```
|
|
|
|
it was then brough into scope by
|
|
```rust
|
|
use rand::Rng;
|
|
// and then used
|
|
rand::thread_rng().gen_range(0..=100);
|
|
```
|
|
|
|
pulling other modules is often the same process
|
|
|
|
the std library is an external package but it doesn't need to be specified in the toml file
|
|
|
|
but it does need to be brought into scope with the ``use`` keyword
|
|
|
|
the std::other_part is an absolute path starting with std for the standard library crate |