- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 rustc
的稳定版本来编译 rocket web 应用程序。 rocket
crate 编译正常,但我想使用来自 rocket_contrib
的静态文件服务器。我的 Cargo.toml
文件如下所示:
[dependencies]
rocket = "0.5.0-rc.1"
[dependencies.rocket_dyn_templates]
version = "0.1.0-rc.1"
features = ["handlebars"]
[dependencies.rocket_contrib]
version = "0.4.10"
default-features = false
features = ["serve"]
当我尝试运行 cargo build
时出现以下错误:
Error: Pear requires a 'dev' or 'nightly' version of rustc.
Installed version: 1.52.1 (2021-05-09)
Minimum required: 1.31.0-nightly (2018-10-05)
最佳答案
从 Rocket 的 0.5 版开始,您不需要使用 rocket_contrib
,因为这个功能被拆分为已经在核心包中或移动到单独的包中的功能。来自 this revision 的注释(另请参阅 issue 1659)提供更多详细信息:
This follows the completed graduation of stable contrib features intocore, removing 'rocket_contrib' in its entirety in favor of two newcrates. These crates are versioned independently of Rocket's corelibraries, allowing upgrades to dependencies without consideration forversions in core libraries.
'rocket_dyn_templates' replaces the contrib 'templates' features. Whilelargely a 1-to-1 copy, it makes the following changes:
- the 'tera_templates' feature is now 'tera'
- the 'handlebars_templates' feature is now 'handlebars'
- fails to compile if neither 'tera' nor 'handlebars' is enabled
'rocket_sync_db_pools' replaces the contrib 'database' features. Itmakes no changes to the replaced features except that the
database
attribute is properly documented at the crate root.
简而言之,您需要将您的代码从 rocket_contrib
中迁移出来。一旦 v0.5 确定发布,可能会提供更好的指南,但在那之前,您可以在 core documentation and respective Cargo feature list 中的 rocket_contrib
中寻找曾经可用的功能。 .
关于rust - 如何在 Rust 的稳定版本上使用 rocket,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67983691/
我是一名优秀的程序员,十分优秀!