rust 学习笔记001入门项目
prepare development environment
use vscode 1.63.0 rust 1.57.0
rust
大写的 V |
- create a new project
cargo new hello-rust
This will generate a new directory calledhello-rust
usecargo runcompile and run project
use cargo check check code but not generate binary
build for release cargo build --release
making a binary programcargo new hello_world --bin
making a librarycargo new hello_world --lib
- Adding dependencies
You can find all sorts of libraries on crates
in Cargo.toml add
[dependencies] |
run cargo build