Crates.io | doc-cfg |
lib.rs | doc-cfg |
version | 0.1.0 |
source | src |
created_at | 2019-02-22 05:09:45.930885 |
updated_at | 2019-02-22 05:09:45.930885 |
description | #[doc_cfg(..)] helper attribute |
homepage | |
repository | https://github.com/arcnmx/doc-cfg |
max_upload_size | |
id | 116424 |
size | 17,095 |
The #[doc_cfg(..)]
attribute is a convenience that removes the boilerplate
involved with using #[doc(cfg(..))]
in stable crates.
Add the following to Cargo.toml
to get started:
[dependencies]
doc-cfg = { version = "0.1" }
[features]
unstable-doc-cfg = []
[package.metadata.docs.rs]
features = ["unstable-doc-cfg"]
In your crate, use #[doc_cfg(..)]
where you'd normally use #[cfg(..)]
:
#![cfg_attr(feature = "unstable-doc-cfg", feature(doc_cfg))]
use doc_cfg::doc_cfg;
#[doc_cfg(windows)]
pub fn cool_nonportable_fn() { }
The name of the feature is important and should not be changed. Check out
the full example for how to use it.
The unstable-doc-cfg
feature should only be turned on when documenting,
#[doc_cfg(..)]
is otherwise identical to #[cfg(..)]
when built without it.
See the documentation and example for up to date usage information.