#cfg #documentation #rustdoc

macro doc-cfg

#[doc_cfg(..)] helper attribute

1 unstable release

0.1.0 Feb 22, 2019

#2076 in Development tools

Download history 23/week @ 2023-11-17 11/week @ 2023-11-24 3/week @ 2023-12-01 3/week @ 2023-12-08 3/week @ 2023-12-15 8/week @ 2023-12-22 2/week @ 2023-12-29 11/week @ 2024-01-05 14/week @ 2024-01-12 7/week @ 2024-01-19 63/week @ 2024-01-26 16/week @ 2024-02-02 76/week @ 2024-02-09 124/week @ 2024-02-16 95/week @ 2024-02-23 29/week @ 2024-03-01

326 downloads per month
Used in 5 crates (4 directly)

MIT license

14KB
220 lines

doc-cfg

travis-badge release-badge docs-badge license-badge

The #[doc_cfg(..)] attribute is a convenience that removes the boilerplate involved with using #[doc(cfg(..))] in stable crates.

Usage

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.

Documentation

See the documentation and example for up to date usage information.

Dependencies

~305KB