Skip to content

jenny07007/rust_official_book

Repository files navigation

cargo new hello-cargo
cargo new --vcs=git hello-cargo # git is the default
cargo build # create an executable file in the target/debug/hello_cargo directory
cargo run # build and run a profect
cargo check # checks code to make sure it compiles but does not produce an executable
cargo build --release # build a release version of the project
git clone example.org/project
cd project
cargo build
  • cargo check is much faster than cargo build, because it skips the step of producting an executable. Many Rustanceans run cargo check periodically as they write their program to make sure it compiles. Then they run cargo build when they're ready to use the executable.

  • We can build a project using cargo build

  • We can build and run a project in one step using cargo run

  • We can build a project without producing a binary to check for errors using cargo check

  • Cargo stores save the result of the build in the targe/debug directory

  • cargo build --release to compile with optimaizations and create an executable in target/rekease

03 Guessing game

Guessing game

04 Variables

Variables

05 Data Types

DataTypes

06 Functions

Functions

07 Control Flow

ControlFlow

08 Ownership

OwnerShip

09 Strucs

Structs

10 Enums and pattern matching

Enums

11 Packages, Crates, and Modules

PCM

12 Common Collections

Collections

13 Error Handling

Error handling

14 Generic Types, Traits, and Lifetimes

GTL

15 Automated Tests

Tests

16 Building a command line program

minigrep

About

My notes on learning Rust from the official Rust book.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages