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: showing implementations of a given trait across the entire ecosystem. #1467

Open
vi opened this issue Aug 17, 2021 · 3 comments
Labels
A-builds Area: Building the documentation for a crate C-enhancement Category: This is a new feature E-hard Effort: This will require a lot of work S-needs-design Status: There's a problem here, but no obvious solution; or the solution raises other questions

Comments

@vi
Copy link

vi commented Aug 17, 2021

As docs.rs knows almost each trait and impl on crates.io, it would be helpful to show foreign implementation for traits in published crates.

@jyn514
Copy link
Member

jyn514 commented Aug 21, 2021

As docs.rs knows almost each trait and impl on crates.io, it would be helpful to show foreign implementation for traits in published crates.

Hmm, it's not as simple as you've made it sound - docs.rs does have all the impls recorded somewhere, but they're not in a format rustdoc can understand, and for rustdoc to understand them it would basically have to recompile each crate on crates.io for each new crate. I guess we could use a shared build cache, but it would quickly get enormous, we wouldn't be able to store it on a single machine, and it would be expensive to store it in the cloud. Even more than that, it would be really slow to load that info each time.

Another alternative is to choose which foreign implementations matter most and add those when documenting - I did that for tokio here: tokio-rs/tokio#3271. Unfortunately this only works if the new crate doesn't depend on the crate you're documenting (because doc-dependencies aren't a thing).

See also #220.

@vi
Copy link
Author

vi commented Aug 22, 2021

recompile each crate on crates.io for each new crate

Why should this be needed? I expect this this feature not to be a part of usual rustdoc documentation, but as some additional layer on top of it: user clicks on "fetch foreign implementations" button and it queries some database.

Rustdoc's job would be to:

  1. Provide structured metadata about which crate of which version implements which trait from which crate of which version. This is to be tracked in the database;
  2. Provide some hooking mechanism to add more UI elements to generated html documents, so that external features can be implemented.

@jyn514
Copy link
Member

jyn514 commented Aug 22, 2021

Hmm, ok. I think this could be built on top of #1285.

@syphar syphar added S-needs-design Status: There's a problem here, but no obvious solution; or the solution raises other questions E-hard Effort: This will require a lot of work A-builds Area: Building the documentation for a crate C-enhancement Category: This is a new feature labels Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builds Area: Building the documentation for a crate C-enhancement Category: This is a new feature E-hard Effort: This will require a lot of work S-needs-design Status: There's a problem here, but no obvious solution; or the solution raises other questions
Projects
None yet
Development

No branches or pull requests

3 participants