我收到此错误:
error: failed to parse manifest at `...Cargo.toml`
Caused by:
Feature `client` depends on `rusttls` which is not an optional dependency.
Consider adding `optional = true` to the dependency
如果我添加optional = true
,它就会消失,但出于安全原因,我不希望 rusttls 是可选的。
此错误的确切原因以及除了使其成为可选之外的可能解决方案是什么?
我的Cargo.toml有这个:
[features]
default = ["client", "server"]
client = ["serde_json", "serde-xml-rs", "serde_ignored", "hyper", "hyper-tls", "rusttls", "tokio-core", "url", "uuid", "multipart"]
server = ["serde_json", "serde-xml-rs", "serde_ignored", "hyper", "hyper-tls", "rusttls", "tokio-core", "tokio-proto", "tokio-tls", "regex", "percent-encoding", "url", "uuid", "multipart"]
从我在 Rust 书中读到的内容来看,这样做应该意味着默认情况下客户端和服务器具有这些依赖项,对吗?
仅当依赖项是可选的依赖项时,才应在功能列表中包含依赖项。如果依赖项不是可选的,请仅将其包含在[dependencies]
部分中。