#documentation #add #macro #facilitate #gated

macro docfg

Convenience macro to add documentation gated features

1 unstable release

0.1.0 Nov 23, 2022

#54 in #facilitate

Download history 5/week @ 2024-11-13 32/week @ 2024-11-20 43/week @ 2024-11-27 51/week @ 2024-12-04 54/week @ 2024-12-11 17/week @ 2024-12-18 14/week @ 2025-01-01 9/week @ 2025-01-08 28/week @ 2025-01-15 19/week @ 2025-01-22 32/week @ 2025-01-29 42/week @ 2025-02-05 26/week @ 2025-02-12 24/week @ 2025-02-19 37/week @ 2025-02-26

131 downloads per month
Used in 9 crates (8 directly)

MIT license

3KB

Crate thet facilitates the documentation of feature-gated code. This crate requires the use of the doc_cfg nightly feature.

Remember to add the following to your Cargo.toml file for the crate make efect when documenting on docs.rs

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

And when generating local documentation, use cargo rustdoc -- --cfg docsrs

Example

#[docfg(test)]
fn test () {
    // ...  
}
#[cfg_attr(docsrs, doc(cfg(test)))]
#[cfg(test)]
fn test () {
    // ...
}

Dependencies

~1.5MB
~38K SLoC