Skip to content

Feature flags docs #256

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

Closed
molpopgen opened this issue Jul 14, 2022 · 3 comments · Fixed by #338
Closed

Feature flags docs #256

molpopgen opened this issue Jul 14, 2022 · 3 comments · Fixed by #338
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@molpopgen
Copy link
Member

We have the docs building for all the public API.
This means that it is not immediately obvious that some
API bits are due to feature flags.

We should have a section in the doc of each item:

# Feature flags

This thing requires the cargo feature "foo"
@molpopgen molpopgen added this to the 0.10.0 milestone Jul 14, 2022
@molpopgen molpopgen added the documentation Improvements or additions to documentation label Jul 14, 2022
@juntyr
Copy link
Contributor

juntyr commented Jul 21, 2022

Since docs are built using nightly on docs.rs, you could make use of the following:

https://doc.rust-lang.org/beta/unstable-book/language-features/doc-cfg.html

https://docs.rs/about/builds

i.e. enable a feature on docs builds, that enabled the unstable doc_cfg feature, which allows you to add #[doc(cfg(...))] to any public item which is cfg-ed.

See https://docs.rs/syn/latest/syn/ for an example of what that looks like

@molpopgen
Copy link
Member Author

Thanks! I'd just read this in "Rust for Rustaceans", which is what got me thinking about it.

@molpopgen
Copy link
Member Author

It does seem like there's some "trust" involved that this will work. I'm unable to get the docs.rs commands from their README to work locally to confirm that the changes actually do anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants