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

Can I add a dependent crate that is a subdirectory in a git repository?

我想使用 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 存储库中添加对这个板条箱的依赖?

来自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" }