this post was submitted on 14 Aug 2023
28 points (96.7% liked)
Rust
5966 readers
11 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
So, this is being worked on. But for now, that crate needs this line in
lib.rs
And this line in
Cargo.toml
's[package.metadata.docs.rs]
section:With these changes, feature gating will be displayed in the docs.
To replicate this locally:
Didn't know about this, looking forward for this to be stabilized. But a comment on your command, it is easier to use --all-features instead of listing them all.
--all-features
doesn't work with that particular crate because two of the features conflict with each other. The features list in my command is the one used for docs.rs from the crate'sCargo.toml
.Sadly, this does not seem to be the norm in my experience. I have not attemped to adding this myself, but I wanted to ask: are there any hurdles or other good reasons to not just adding this to every create? Why isn't it the default?
I'm no expert. But my guess would be that many crate authors may simply not be aware of this feature. It wasn't always there, and it's still unstable. You would have to reach the "Unstable features" page of the rustdoc book to know about it.
Or maybe some know about it, but don't want to use an unstable feature, or are just waiting for it to possibly automatically work without any modifications.
Of course, I would assume none of this applies to the
embassy
devs. ThatCargo.toml
file has aflavors
field, which is something I've never seen before 😉 So, I'm assuming they are way more knowledgable (and up-to-date) about the Rust ecosystem than me.