Closed sunsided closed 3 months ago
This is great, thanks - I wasn't aware of this feature.
Before I merge this PR please can you either add this attribute to the rest of the feature-enabled functions in this crate or create a GitHub issue to track that someone needs to do so.
I should have covered the relevant ones, but I'll have another look. Specifically I skipped the example code as that won't be in the docs either, ignored the feature switches that are explicitly in code for the same reason, and skipped everything that is purely test related.
I'll have another look though.
Ah, the other uses I was thinking of are actually hidden inside functions, e.g. https://github.com/image-rs/imageproc/blob/44bbf5e7efd8d9de41ffafc2be2a0696cfecfb4b/src/contrast.rs#L245
Maybe there are no missed uses then!
Hum, I think my IDE tricked me and there are indeed some missing. I'll push to the branch again and re-open the PR then. ✌🏼
Edit: in #612
I believe you can also do #![cfg_attr(docsrs, feature(doc_auto_cfg))]
to automatically apply the annotation everywhere
Thanks @fintelia - definitely worth a look
This adds the
#[cfg_attr(docsrs, doc(cfg(feature = "...")))]
markers to inform docs.rs about feature conditions. It looks somewhat like this;Since this is a feature that only works with docs.rs, it's gated by the
#![cfg_attr(docsrs, feature(doc_cfg))]
attribute inlib.rs
.