rust - 功能 'xxx' 依赖于 'yyy',这不是可选依赖项
问题描述
我收到了这个错误:
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]
部分中。
推荐阅读
- javascript - 如何让谷歌仪表从其上方的函数创建的输入标签中读取数据
- rest - Salesforce API - 使用复合字段。(无法从 VALUE_STRING 反序列化 MailingAddress 实例)
- java - 获取文件作为类路径上的资源
- spring - 如何在 Spring JPA 中访问嵌入式类的字段
- json - 使用 Codeable 难以从 JSON 中提取数据
- android - 更改 ProgressBar 的颜色在 API<21 中不起作用
- android-studio - Flutter Doctor 1.2.1 更新后给出两个 android studio 版本
- apache - htaccess 从 url 中删除特定的 get 参数
- python-3.x - 加密不支持 python 3.x?
- r - ggtern 的三元图在闪亮时不起作用