Skip to content

reference feature flags in docs#259

Merged
hecrj merged 4 commits into
iced-rs:masterfrom
robjtede:docs/feature-flags
Apr 5, 2020
Merged

reference feature flags in docs#259
hecrj merged 4 commits into
iced-rs:masterfrom
robjtede:docs/feature-flags

Conversation

@robjtede

@robjtede robjtede commented Apr 4, 2020

Copy link
Copy Markdown
Contributor

Makes it clearer when browsing docs which feature flags are needed for certain features using a docsrs config flag.

Test locally using:

RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --workspace --lib --no-deps --all-features --open

eg:
2020-04-04_02 26 46-e99bc6aa

@hecrj hecrj added the improvement An internal improvement label Apr 5, 2020
@hecrj

hecrj commented Apr 5, 2020

Copy link
Copy Markdown
Member

I like the idea!

I believe it's a bit noisy when marking whole modules, as mentioned in rust-lang/rust#43781 (comment).

Maybe we could settle with a note in the module documentation for the time being, while the feature matures.

@robjtede

robjtede commented Apr 5, 2020

Copy link
Copy Markdown
Contributor Author

Yeah, honestly the reason I didnt do everything yet is incase you said that. Project like Tokio has gone ahead with this approach: https://docs.rs/tokio/0.2.16/tokio/fs/index.html, https://docs.rs/tokio/0.2.16/tokio/fs/struct.File.html.

Should do something to make the features clearer though. Did trip me up initially when starting with the canvas module. Note in the module doc would be fine, too.

@hecrj

hecrj commented Apr 5, 2020

Copy link
Copy Markdown
Member

Should do something to make the features clearer though. Did trip me up initially when starting with the canvas module. Note in the module doc would be fine, too.

Agreed. After thinking some more about it, I believe it's better to be too noisy than failing to warn our users properly. I also feel the warning blends in nicely once you get used to it. And if it's too distracting, you can always run cargo doc yourself.

So let's keep it! I added the message to the widgets in the root crate and enabled the feature flags for docs.rs. Let me know if I screwed something up!

@hecrj hecrj added this to the 0.1.1 milestone Apr 5, 2020
@robjtede robjtede marked this pull request as ready for review April 5, 2020 12:27
@robjtede

robjtede commented Apr 5, 2020

Copy link
Copy Markdown
Contributor Author

LGTM

@hecrj

hecrj commented Apr 5, 2020

Copy link
Copy Markdown
Member

Awesome. Thank you! 🥂

@hecrj hecrj merged commit ad0a6c4 into iced-rs:master Apr 5, 2020
@robjtede robjtede deleted the docs/feature-flags branch April 5, 2020 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement An internal improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants