[][src]Attribute Macro doc_cfg::doc_cfg

#[doc_cfg]

The #[doc_cfg(..)] attribute works much like #[cfg(..)], but it allows the item being documented to show up in the crate documentation when built on a platform or configuration that doesn't match the predicate.

It can be used like so:

#![cfg_attr(feature = "unstable-doc-cfg", feature(doc_cfg))]

use doc_cfg::doc_cfg;

#[doc_cfg(windows)]
pub fn cool_nonportable_fn() { }

Check out the full example to see how it looks.

#[doc(cfg(..))]

In cases where the predicate contains irrelevant implementation details or private dependency names you can specify an alternate condition to be included in the documentation:

#![cfg_attr(feature = "unstable-doc-cfg", feature(doc_cfg))]

use doc_cfg::doc_cfg;

#[doc_cfg(feature = "__private_feature")]
#[doc(cfg(feature = "cargo-feature-flag"))]
pub fn cool_fn() { }