Index
- Guessing Game
- Common Programming Concepts
- Understanding Ownership
- Using Structs
- Enums and Pattern Matching
- Managing Growing Projects with Packages, Crates, and Modules
- Defining Modules to Control Scope and Privacy
- Paths for Referring to an Item in the Module Tree
- Bringing Paths into Scope with the use Keyword
- Separating Modules into Different Files
- Common Collections
- Error Handling
- Generic Types, Traits, and Lifetimes
- Writing Automated Tests
- Object Oriented Programming
- Adding dependancies
- Option Take
- RefCell
- mem
- Data Structure
- Recipe
- Semi colon
- Calling rust from python
- Default
- Crytocurrency With rust
- Function chaining
- Question Mark Operator
- Tests with println
- lib and bin
- Append vector to hash map
- Random Number
- uuid4
- uwrap and option
- Blockchain with Rust
- Near Protocol
- Actix-web
Adding dependancies
Takeaway code:
cargo add rand@0.6.0 // get ths specified version
cargo add rand // Gets the latest version
cargo add rand // Gets the latest version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adding a dependency
If your Cargo.toml doesn't already have a [dependencies] section, add that, then list the crate name and version that you would like to use. This example adds a dependency of the time crate:
[dependencies]
time = "0.1.12"
time = "0.1.12"
Re-run cargo build to fetch the new dependencies and all of their dependencies and compile them all, and update then Cargo.lock
cargo build
Install cargo edit
cargo install cargo-edit
Then you can use cargo add
cargo add rand@0.6.0 // get ths specified version
cargo add rand // Gets the latest version
cargo add rand // Gets the latest version