简体   繁体   English

如何使用 cargo 更新板条箱注册表(索引)

[英]how to update crate registry (index) using cargo

using cargo (version 1.46.0 (04488afe3 2020-08-24)) or any other rust toolchain, what is the official way to force the update of the crate registry (crate.io index) without deleting manually ~/.cargo/registry/index ?使用cargo (版本 1.46.0 (04488afe3 2020-08-24))或任何其他 rust 工具链,在不手动删除~/.cargo/registry/index的情况下强制更新板条箱注册表(crate.io 索引)的官方方法是什么~/.cargo/registry/index

I've done this by creating a temporary cargo project and adding a small dependency to it.我通过创建一个临时货物项目并向其添加一个小的依赖项来完成此操作。 Something like this:是这样的:

mkdir /tmp/deleteme \
    && cd /tmp/deleteme \
    && cargo init \
    && cargo add serde \
    && rm -rf /tmp/deleteme

You should immediately see the message:您应该立即看到消息:

Updating crates.io index

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM