git - 我可以在 git 存储库中添加一个作为子目录的依赖包吗?

标签 git rust rust-cargo

我想使用 EDN 解析器,但它在 https://github.com/mozilla/mentat 中. https://github.com/mozilla/mentat/tree/master/edn有自己的 Cargo.toml。

我试过这个:

[dependencies]
edn = { git = "https://github.com/mozilla/mentat/tree/master/edn" }

但它不起作用。

是否可以在 mentat 存储库中添加对这个 crate 的依赖?

最佳答案

来自 the Cargo documentation :

Cargo will fetch the git repository at this location then look for a Cargo.toml for the requested crate anywhere inside the git repository (not necessarily at the root).

(强调我的)

这意味着你可以说:

[dependencies]
edn = { git = "https://github.com/mozilla/mentat" }

关于git - 我可以在 git 存储库中添加一个作为子目录的依赖包吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50351721/

相关文章:

git - 添加到 git staging 意味着什么?

rust - Rust 0.10 中的条件编译?

rust - 在字符串字符 for 循环中使用可变或不可变引用

rust - 无法使用 cargo uninstall 卸载 ~/.cargo : package id specification matched no package 中的包

testing - 如何让 Cargo Test 漂亮地打印失败输出

macos - 请输入提交消息来解释为什么需要进行此 merge ,特别是如果它将更新的上游 merge 到主题分支中

git - `git-p4 clone` 失败 "new tip ... does not contain ..."

rust - cargo 的多个 Rust 源文件

git - 将提交从一个分支移动到另一个分支

macros - 在 Rust 中解析匹配武器的递归宏