我得到了这个错误:
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书中读到的内容,这样做应该意味着默认情况下客户端和服务器具有这些依赖关系,对吧?
发布于 2019-10-21 21:42:24
如果依赖关系是可选的,则只应在功能列表中包括该依赖关系。如果依赖项不是可选的,则仅将其包含在[dependencies]部分中。
https://stackoverflow.com/questions/58485723
复制相似问题