英文:
How to specify multiple Directory Sources in the .cargo/config.toml file in Rust?
问题
通常情况下,如果您希望`cargo`使用供应商提供的外部依赖代码(而不是访问[crates.io](https://crates.io/)或`$CARGO_HOME/registry/cache`),您可以将以下内容添加到您的`.cargo/config.toml`文件中:
```toml
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "relative/path/to/director/source" # 相对于.cargo目录的父目录
relative/path/to/directory/source
包含供应商提供的软件包(以及它们自己的依赖项),作为包含未打包的.crate
文件内容的子目录。
我的目标是在上面的[source.vendored-sources]
中指定多个directory
。或者更一般地说,在构建包时指定cargo
检查供应商代码的多个目录源。
这是否可行?
<details>
<summary>英文:</summary>
Normally, if you wish `cargo` to use vendored code for external dependencies (instead of reaching into [crates.io](https://crates.io/) or `$CARGO_HOME/registry/cache`), you add the following into your `.cargo/config.toml` file :
```toml
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "relative/path/to/director/source" # relative to parent of .cargo directory
With relative/path/to/directory/source
containing the vendored packages (along with their own dependencies), as sub-directories containing the contents of unpacked .crate
files.
My objective is to specify more than one directory
for [source.vendored-sources]
above. Or just in general, specify multiple Directory Sources for cargo
to check for vendored code, when building a package.
Is it possible?
答案1
得分: 1
很抱歉,截止到此刻,用户无法控制目录源如何发现包。
> DirectorySource
目前只是一个包含其他目录的根目录,这些目录包含了包的源文件。
英文:
Unfortunately, as of this writing, users have no control over how a directory source discovers packages.
From the Cargo API documentation:
> DirectorySource
at this moment is just a root directory containing
> other directories, which contain the source files of packages.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论