Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use doc_cfg (#[doc(cfg(feature = "..."))]) to show feature requirements #365

Closed
kazk opened this issue Jan 2, 2021 · 0 comments · Fixed by #370
Closed

Use doc_cfg (#[doc(cfg(feature = "..."))]) to show feature requirements #365

kazk opened this issue Jan 2, 2021 · 0 comments · Fixed by #370
Labels
docs unclear documentation

Comments

@kazk
Copy link
Member

kazk commented Jan 2, 2021

Show these in docs for derive and ws:
image

![feature(doc_cfg)] is nightly only, but docs.rs uses nightly by default.

From https://stackoverflow.com/a/61417700

# docs.rs-specific configuration
[package.metadata.docs.rs]
# document all features
all-features = true
# defines the configuration attribute `docsrs`
rustdoc-args = ["--cfg", "docsrs"]
// only enables the `doc_cfg` feature when
// the `docsrs` configuration attribute is defined
#[cfg_attr(docsrs, feature(doc_cfg))]

#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
pub fn test() {}
@kazk kazk added the docs unclear documentation label Jan 2, 2021
kazk added a commit to kazk/kube-rs that referenced this issue Jan 5, 2021
@clux clux closed this as completed in #370 Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs unclear documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant