docs.rs
docs.rs copied to clipboard
Feature request: showing implementations of a given trait across the entire ecosystem.
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.
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: https://github.com/tokio-rs/tokio/pull/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 https://github.com/rust-lang/docs.rs/issues/220.
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:
- 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;
- Provide some hooking mechanism to add more UI elements to generated html documents, so that external features can be implemented.
Hmm, ok. I think this could be built on top of https://github.com/rust-lang/docs.rs/issues/1285.
a related idea from @artech-git:
Hi @syphar my initial idea & https://github.com/rust-lang/docs.rs/issues/1467 are pretty close, what I think would be amazing to have if it can indexed on the docs.rs server itself and also to show a distinct filtering regarding whether the crate who are implementing this have it implemented internally or is it public in on the object types of the crate.