docs.rs icon indicating copy to clipboard operation
docs.rs copied to clipboard

Copy crate name, version with feature flags?

Open ssiyad opened this issue 1 year ago • 2 comments
trafficstars

In docs.rs, we can copy a crate's name and version to be pasted into Cargo.toml. Is there any way to include feature flags into this?

tower-http = "0.5.1" -> tower-http = { version = "0.5.1", features = ["trace"] }

image

ssiyad avatar Feb 03 '24 11:02 ssiyad

Hi,

thank you for the idea!

Could you elaborate on how you imagine this to look like? How would we know which features to add here?

Where do you see the advantage over cargo add CRATE VERSION -F feature_name? (where crate and version could be pasted from our output).

syphar avatar Feb 04 '24 05:02 syphar

Assume, in /features page (Feature flags), we have checkbox beside every feature. We can select features we want. We can then use the Copy button. Screenshot 2024-02-07 at 12 03 35 AM

I think this is better than cargo add because we can interactively select features and also skip the cargo add step entirely.

It might not be a good idea to include all available features in header dropdown. I believe we can add features from full but I have no idea how they work :)

ssiyad avatar Feb 06 '24 18:02 ssiyad