基础

安装

curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

命令

# 编译
rustc main.rs
# cli
cargo run
cargo build
cargo build --release

依赖更新

cargo update            # 更新所有依赖
cargo update -p regex   # 只更新 “regex”

镜像替换

$HOME/.cargo/config.toml 配置中添加以下内容:

[source.crates-io]
replace-with = 'ustc'

[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

使用科大镜像在新窗口打开

单测

assert_eq!()
上次更新:
贡献者: Joe