rust 学习笔记001入门项目

prepare development environment

use vscode 1.63.0 rust 1.57.0
rust

# 大写的 V
rustc -V
cargo -V
  1. create a new project cargo new hello-rust
    This will generate a new directory called hello-rust
    use cargo run compile and run project

use cargo check check code but not generate binary
build for release cargo build --release

making a binary program
cargo new hello_world --bin
making a library
cargo new hello_world --lib

  1. Adding dependencies

You can find all sorts of libraries on crates

in Cargo.toml add

[dependencies]
ferris-says = "0.1"

run cargo build