1 个不稳定版本
0.1.0 | 2019年2月22日 |
---|
#2270 在 开发工具 中
每月下载 247 次
用于 10 个crate(直接使用 4 个)
14KB
220 代码行
doc-cfg
#[doc_cfg(..)]
属性是一个方便的快捷方式,用于移除在稳定版crate中使用 #[doc(cfg(..))]
时所涉及的模板代码。
使用方法
要将以下内容添加到 Cargo.toml
中以开始使用
[dependencies]
doc-cfg = { version = "0.1" }
[features]
unstable-doc-cfg = []
[package.metadata.docs.rs]
features = ["unstable-doc-cfg"]
在您的crate中,使用 #[doc_cfg(..)]
,在您通常使用 #[cfg(..)]
的地方
#![cfg_attr(feature = "unstable-doc-cfg", feature(doc_cfg))]
use doc_cfg::doc_cfg;
#[doc_cfg(windows)]
pub fn cool_nonportable_fn() { }
功能名称很重要,不应更改。查看 使用示例。在编写文档时应仅启用 unstable-doc-cfg
功能,否则 #[doc_cfg(..)]
与 #[cfg(..)]
无异。
文档
依赖项
~315KB