在toml中导入别名为的rust包

在toml中导入别名为的rust包,rust,rust-crates,toml,Rust,Rust Crates,Toml,我试图制作一个简单的程序来检查同一个rust项目的两个不同分支上的执行时间 我想让我的汤姆看起来像这样 [dependencies] cron_original = { git = "https://github.com/zslayton/cron" } cron_fork = { git = "https://github.com/koenichiwa/cron", branch = "feature/reimplement-queries&q

我试图制作一个简单的程序来检查同一个rust项目的两个不同分支上的执行时间

我想让我的汤姆看起来像这样

[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?*”;
让schedule\u orig=cron\u original::schedule::from\u str(表达式);
让schedule\u fork=cron\u fork::schedule::from\u str(表达式);
//检查这些结构上执行时间的差异
}

但是我发现
没有找到名为“cron\u fork”的匹配包。是否仍要导入具有特定别名的包?我正在考虑创建这样的自动检查功能。

您需要为这些依赖项指定
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中的重命名依赖项部分