在Rust中,cargo使用国内镜像源
一个编程语言依赖包管理的普通问题。 cargo解决得比较优雅。 一,新建$HOME/.cargo/config文件 [source.crates-io] registry = "https://github.com/rust-lang/crates.io-index" replace-with = 'ustc' [source.ustc] registry = "git://mirrors.ustc.edu.cn/crates.io-index" 二,项目cargo.toml内容 [package] name = "guessing_game" version = "0.1.0" authors = ["aguncn <aguncn@163.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] rand = "0.5.5" 三,cargo build命令 四,更新完成之后,Cargo.lock文件内容 # This file is automatically @generated by Cargo. # It is not intended for manual