rustup

rustup国内镜像

设置环境变量

  1. RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup

更新

  1. rustup update stable

Cargo

  1. cargo new foo_project
  2. cargo build
  3. cargo run

Cargo.toml

  1. [package]
  2. name = "foo"
  3. version = "0.1.0"
  4. authors = ["Your Name <you@example.com>"]
  5. edition = "2018"
  6. [dependencies]

国内源

~/.cargo目录下创建config写入下面信息。

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

VS Code插件

crates
CodeLLDB
rust-analyzer
TOML Language Support
Rust Test Explorer
官方Rust插件可选。