我如何告诉 Cargo 检查本地目录以查找替换依赖项并使用它?

How do I tell Cargo to check a local directory for a replacement dependency and use it?

我正在尝试了解如何更改 Rust 中损坏的依赖项。我从 GitHub 克隆了代码并更新了 Cargo.toml 中的依赖项以便它可以编译,但是如何在我的项目中使用它?

查看 Cargo documentation on overriding a dependency:

Cargo looks for a directory named .cargo up the directory hierarchy of your project [...] To specify overrides, create a .cargo/config file in some ancestor of your project’s directory [...] Inside that file, put this:

paths = ["/path/to/project"]

This array should be filled with directories that contain a Cargo.toml.