【问题标题】:Can I add a dependent crate that is a subdirectory in a git repository?我可以添加一个依赖板条箱,它是 git 存储库中的子目录吗?
【发布时间】:2018-03-28 22:58:03
【问题描述】:

我想使用 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 的依赖?

【问题讨论】:

    标签: git rust rust-cargo


    【解决方案1】:

    来自the Cargo documentation

    Cargo 将在该位置获取 git 存储库,然后在 git 存储库内(不一定在根目录任何地方 为请求的 crate 查找 Cargo.toml

    强调我的

    这意味着你可以说:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-21
      • 2020-06-02
      • 2015-09-12
      • 1970-01-01
      • 2021-08-13
      • 2012-04-19
      • 2021-11-20
      相关资源
      最近更新 更多