You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: list crate features at the top of package index.html #590
When learning Rust, it's surprising to not find a namespace available within a package. Having crate features available at the top of the docs.rs package would be a great indication that some namespaces are gated behind features.
I think listing all the features of the crate is useful and in scope (maybe under the crate tab). However, we can't put it on the page for every module since those pages are generated by rustdoc.
Reacted by Nora Breitmoser-Widdecke and Geobert Quach
Or in other words: just finding which features are available is simple, we just parse Cargo.toml; finding what changes when a given feature is enabled/disabled requires expanding macros and parsing the code and also lies on a weird boundary between cargo and rustdoc.
One change I would suggest for the example drop-down would be to highlight the default feature, maybe by moving it to the top and adding a little whitespace/horizontal rule between it and the rest.
Activity
jyn514 commentedon Feb 6, 2020
I think listing all the features of the crate is useful and in scope (maybe under the
cratetab). However, we can't put it on the page for every module since those pages are generated by rustdoc.jyn514 commentedon Feb 6, 2020
Or in other words: just finding which features are available is simple, we just parse
Cargo.toml; finding what changes when a given feature is enabled/disabled requires expanding macros and parsing the code and also lies on a weird boundary between cargo and rustdoc.jyn514 commentedon Mar 19, 2020
There's an extension that adds this already and I like their approach - they put an extra
Featuresdrop-down in the header at the top.https://rust-search-extension.now.sh/feature-flags.png
jyn514 commentedon Apr 24, 2020
Relevant code:
Cargo.tomlparsing - note that this isCargoMetadata, notMetadata.Metadatais only used for controlling the build parameters.Nemo157 commentedon May 6, 2020
One change I would suggest for the example drop-down would be to highlight the
defaultfeature, maybe by moving it to the top and adding a little whitespace/horizontal rule between it and the rest.jyn514 commentedon Nov 16, 2020
This was added in #1144.