#documentation #add #macro #facilitate #gated

macro docfg

Convenience macro to add documentation gated features

1 unstable release

0.1.0 Nov 23, 2022

#37 in #facilitate

Download history 22/week @ 2024-01-08 7/week @ 2024-01-15 8/week @ 2024-01-22 7/week @ 2024-01-29 18/week @ 2024-02-05 21/week @ 2024-02-12 34/week @ 2024-02-19 41/week @ 2024-02-26 39/week @ 2024-03-04 35/week @ 2024-03-11 38/week @ 2024-03-18 67/week @ 2024-03-25 78/week @ 2024-04-01 33/week @ 2024-04-08 42/week @ 2024-04-15

222 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
~34K SLoC