我想用铁锈把我的excel数据库链接起来。我编写了以下代码,但出现了一些错误。
use calamine::{open_workbook,Render,xlsx};//
fn main(){
let xl_book_path="Your Excle Book Path.xlsx";
let met wb: Xlsx<_> = opne_workbook(Xl_book_path).expect("cannot open xl book");
}error[E0432]: unresolved import `calamine`
--> Aut.rs:1:5
| 1 | use calamine::{open_workbook,Render,xlsx};
| ^^^^^^^^ maybe a missing crate `calamine`?
| = help: consider adding `extern crate calamine` to use the `calamine` crate
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0432`.我认为原因是缺少calamine在Cargo.toml,所以我添加了炉甘石到Cargo.toml。
[dependencies] calamine = "0.18.0"但错误仍然出现。我该如何解决这个问题?
发布于 2022-11-09 12:27:34
要添加依赖项,[dependencies]部分应该如下所示:
[dependencies]
calamine = "0.19.1"你不能把它们放在同一条线上。
然后可以使用cargo run从项目目录( Cargo.toml所在的位置)运行项目,它应该可以找到calamine。
https://stackoverflow.com/questions/74343458
复制相似问题