rust - 用于 lib 的 Cargo.toml

标签 rust rust-cargo rust-obsolete

我想为 Rust 创建一个库。这是我项目的 Cargo.toml 文件:

[package]
name = "binary_tree"
version = "0.0.1"
authors = ["Guillaume Bersac <bersac_1@hotmail.fr>"]

[lib]
test = true
plugin = false

这是我存储库的文件:

Cargo.toml
README.md
src
|_node.rs

当我运行命令“cargo run”或“cargo build”或“cargo test”时,我收到以下错误消息:

Cargo.toml is not a valid manifest

expected a value of type array, but found a value of type table for the key lib

如何格式化我的 Cargo.toml 以使其正确编译?

最佳答案

你运行的是最新的 rustccargo 吗?如果没有,我认为您过去需要 [[lib]],它在 TOML 中创建一个表数组。

关于rust - 用于 lib 的 Cargo.toml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26434053/

相关文章:

rust - &T 和 T/&, ~T 和 T/~ 的区别

rust - Actix Web actor的创建不止一次

rust - 是否可以将 Rc<T> 映射为 Rc<Subpart-of-T>?

python - 如何在 PyO3 中实现 python 运算符

rust - 如何在 Fn 特征绑定(bind)返回引用上定义生命周期?

rust - 如何包含 sdl2

Rust cargo.toml 为 C 链接器和编译器指定自定义路径

rust - cargo 建立时“A fatal alert message was received from our peer” SSL错误

rust - Rust 泛型中的常量值

rust - "borrowed value does not live long enough"将结构与切片一起使用时