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

Docs don't include entries from features #450

Open
Zapeth opened this issue Apr 13, 2020 · 4 comments
Open

Docs don't include entries from features #450

Zapeth opened this issue Apr 13, 2020 · 4 comments

Comments

@Zapeth
Copy link

Zapeth commented Apr 13, 2020

I'm not experienced with rust package documentation so I might be missing something, but the documentation at https://docs.rs/glfw only lists the default code without any of the extra features (vulkan being the important one for me here).

@bvssvni
Copy link
Member

bvssvni commented Apr 15, 2020

I don't know how to include the other settings in the docs. Is there a feature for this, or it could already be a known issue?

@Zapeth
Copy link
Author

Zapeth commented Apr 16, 2020

Looking at other popular rust packages it at least looks like its possible, though I don't know to what extent -> https://docs.rs/tokio/0.2.18/tokio/process/index.html

I don't know the process behind publishing the documentation for a crate, but in regards to including elements of specific features I imagine something like cargo doc --features <all-features> and specific documentation markings for those elements in the code are necessary (perhaps you can see how its done in the example I linked above).

edit: It looks like they're using an experimental feature -> rust-lang/rust#43781

@bvssvni
Copy link
Member

bvssvni commented Apr 20, 2020

Is there a way to use experimental features with backward compatibility?

@Nemo157
Copy link

Nemo157 commented May 6, 2020

For that specific feature you can tell docs.rs to enable a cfg flag like here (along with enabling --all-features to build everything). Then only conditionally use the feature based on that cfg flag (#[cfg_attr(docsrs, doc(cfg(feature = "stream")))]). That means people building docs locally would not see the features highlighted, unless they build with RUSTDOCFLAGS=--cfg=docsrs cargo doc, but the online documentation would include it.

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

No branches or pull requests

3 participants