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
Rust
Referenceshttps://doc.rust-lang.org/book/
Takeaway code:
cargo new hello_cargo
cargo new --lib hello_library
cargo check // Doesnot produce executable
cargo build
cargo run
cargo init
cargo new --lib hello_library
cargo check // Doesnot produce executable
cargo build
cargo run
cargo init
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Creating a Project with Cargo
cargo new hello_cargo
cd hello_cargo
cd hello_cargo
Cargo.toml
This file is in the TOML (Tom’s Obvious, Minimal Language) format, which is Cargo’s configuration format.
Building and Running a Cargo Project
In the hello_cargo folder (project folder)
cargo build
This command creates an executable file in target/debug/hello_cargo
Cargo.lock file keeps track of the exact versions of dependencies in your project.
cargo run
cargo check
Cargo also provides a command called
cargo check
. This command quickly checks your code to make sure it compiles but doesn’t produce an executableBuilding for Release
When your project is finally ready for release, you can use
cargo build --release
to compile it with optimizations.