Cargo字节镜像源

在 Windows 系统默认为:%USERPROFILE%.cargo,在类 Unix 系统默认为:$HOME/.cargo,在此目录下新建config文件,填写内容如下:

php 复制代码
[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

源替换:

source.crates-io\]:这一部分指定了 crates.io 作为默认源。 replace-with = 'rsproxy':这行配置表示将 crates.io 源替换为 rsproxy。 **自定义源配置:** \[source.rsproxy\]:定义了一个名为 rsproxy 的源。 registry = "https://rsproxy.cn/crates.io-index":指定了 rsproxy 源的注册表 URL。 **稀疏索引配置(需要 Cargo 1.68 及以上版本):** \[source.rsproxy-sparse\]:定义了一个名为 rsproxy-sparse 的源,用于稀疏索引。 registry = "sparse+https://rsproxy.cn/index/":指定了稀疏索引源的注册表 URL。 **注册表配置:** \[registries.rsproxy\]:定义了一个名为 rsproxy 的注册表。 index = "https://rsproxy.cn/crates.io-index":指定了注册表的索引 URL。 **网络配置:** \[net\]:定义了网络相关的配置。 git-fetch-with-cli = true:这行配置指定了在处理 git 依赖时使用命令行工具。 丰富内容

相关推荐
m0_480502642 小时前
Rust 入门 泛型和特征-特征对象 (十四)
开发语言·后端·rust
RustFS3 小时前
如何用 Rust 对 RustFS MCP Server 进行扩展?
rust
我是前端小学生2 天前
一文梳理Rust语言中的可变结构体实例
rust
Source.Liu2 天前
【unitrix数间混合计算】2.21 二进制整数加法计算(bin_add.rs)
rust
Include everything3 天前
Rust学习笔记(二)|变量、函数与控制流
笔记·学习·rust
Source.Liu3 天前
【unitrix数间混合计算】2.20 比较计算(cmp.rs)
rust
许野平3 天前
Rust:构造函数 new() 如何进行错误处理?
开发语言·后端·rust
许野平3 天前
Rust:专业级错误处理工具 thiserror 详解
rust·error·错误处理·result·thiserror
蒋星熠3 天前
Rust 异步生态实战:Tokio 调度、Pin/Unpin 与零拷贝 I/O
人工智能·后端·python·深度学习·rust