Merge branch 'master' of https://github.com/wenyongda/XiaodaBlogSource
This commit is contained in:
commit
1f0f301c5b
@ -224,6 +224,62 @@ fn main() {
|
||||
{}
|
||||
```
|
||||
|
||||
# Rust 格式化代码
|
||||
|
||||
## rustfmt
|
||||
|
||||
只会格式化单个Rust文件
|
||||
|
||||
```shell
|
||||
rustfmt main.rs
|
||||
```
|
||||
|
||||
## cargo fmt
|
||||
|
||||
会格式化整个Rust项目
|
||||
|
||||
```shell
|
||||
cargo fmt
|
||||
```
|
||||
|
||||
# Rust 构建
|
||||
|
||||
基于cargo 创建的整个项目进行构建
|
||||
|
||||
```shell
|
||||
cargo build
|
||||
# 简写
|
||||
cargo b
|
||||
```
|
||||
|
||||
默认按照Debug模式进行构建
|
||||
|
||||
若进行Release模式构建
|
||||
|
||||
```shell
|
||||
cargo build --release
|
||||
cargo b --release
|
||||
```
|
||||
|
||||
# Rust 运行
|
||||
|
||||
默认先按照Debug模式进行构建,然后再执行可执行文件
|
||||
|
||||
```shell
|
||||
cargo run
|
||||
# 简写
|
||||
cargo r
|
||||
```
|
||||
|
||||
想只输出实际内容
|
||||
|
||||
```shell
|
||||
cargo run --quiet
|
||||
cargo r --quiet
|
||||
```
|
||||
|
||||
|
||||
|
||||
# Rust 基础语法
|
||||
|
||||
变量,基本类型,函数,注释和控制流,这些几乎是每种编程语言都具有的编程概念。
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user