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

Feature request: list crate features at the top of package index.html #590

Closed
kespindler opened this issue Feb 6, 2020 · 6 comments
Closed
Labels
A-frontend Area: Web frontend E-medium Effort: This requires a fair amount of work P-medium Medium priority

Comments

@kespindler
Copy link

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.

@jyn514
Copy link
Member

jyn514 commented Feb 6, 2020

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.

@jyn514 jyn514 added the wishlist label Feb 6, 2020
@jyn514
Copy link
Member

jyn514 commented 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
Copy link
Member

jyn514 commented Mar 19, 2020

There's an extension that adds this already and I like their approach - they put an extra Features drop-down in the header at the top.

https://rust-search-extension.now.sh/feature-flags.png

@jyn514
Copy link
Member

jyn514 commented Apr 24, 2020

Relevant code:

@Nemo157
Copy link
Member

Nemo157 commented May 6, 2020

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.

@jyn514
Copy link
Member

jyn514 commented Nov 16, 2020

This was added in #1144.

@jyn514 jyn514 closed this as completed Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Web frontend E-medium Effort: This requires a fair amount of work P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

3 participants