学习rust

2023更新

 cat $HOME/.cargo/config.toml
[source.crates-io]
replace-with = 'rsproxy'

[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"

# 稀疏索引,要求 cargo >= 1.68
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"

[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"

[net]
git-fetch-with-cli = true

rust 编程

  1. 安装 curl https://sh.rustup.rs -sSf | sh
  2. 第一个程序 cargo new hello --bin
  3. 查看项目中依赖模块的帮助文档 cargo doc --open
  4. 入门书籍

其他命令

  1. 查看版本 rustc --version && cargo --version
  2. 依赖包更新cargo update
  3. 运行 cargo build && cargo run 或者cargo run
posted @ 2021-04-27 16:30  bregman  阅读(72)  评论(1)    收藏  举报