Expand description
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"]
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, the
#[doc_cfg(..)]
attribute is otherwise identical to #[cfg(..)]
when built
without it.
Attribute Macros§
- 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.