Rust,Hello !

从0开始 Rust

配置安装 cargo

配置 cargo 镜像

进入文件夹 : cargo 安装目录

默认(~/.cargo)

创建文件 config

1
2
3
4
5
6
7
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'

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

更多配置 参考文档

1
2
3
4
5
6
7
8
9
[alias]     # command aliases
b = "build"
c = "check"
t = "test"
r = "run"
rr = "run --release"
recursive_example = "rr --example recursions"
space_example = ["run", "--release", "--", "\"command list\""]

启航

Rust 练习引导项目,安装 rustlings

1
2
3
4
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.5.1)
git clone -b 5.5.1 --depth 1 https://github.com/rust-lang/rustlings
cd rustlings
cargo install --force --path .

不积跬步,无以至千里

1
rustlings watch

完成练习后,卸载 rustlings

1
cargo uninstall rustlings