我试图制作一个简单的程序,检查同一锈蚀项目的两个不同分支的执行时间。
我想让我的.toml看起来像这样
[dependencies]
cron_original = { git = "https://github.com/zslayton/cron" }
cron_fork = { git = "https://github.com/koenichiwa/cron", branch = "feature/reimplement-queries"}我的程序看起来是这样的:
fn main() {
let expression = String::from("0-59 * 0-23 ?/2 1,2-4 ? *");
let schedule_orig = cron_original::Schedule::from_str(expression);
let schedule_fork = cron_fork::Schedule::from_str(expression);
// Check difference in execution times on these structs
}但我得到了no matching package named 'cron_fork' found。是否需要导入带有特定别名的包?我正在考虑创建这样的自动检查的东西。
发布于 2021-02-20 10:05:14
您需要为这些依赖项指定package键,这样即使您指定了一个不同的名称,cargo也知道您确实需要这些包:
[dependencies]
cron_original = { git = "https://github.com/zslayton/cron", package="cron" }
cron_fork = { git = "https://github.com/koenichiwa/cron", branch = "feature/reimplement-queries", package="cron" }有关详细信息,请参阅Cargo.toml文档中的指定依赖项部分中的重命名依赖项。
https://stackoverflow.com/questions/66289830
复制相似问题