rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.47k stars 12.73k forks source link

rustdoc: First line of documentation on collapsed impl blocks should be visible #130612

Open crumblingstatue opened 1 month ago

crumblingstatue commented 1 month ago

There exists a technique to make a type's methods more organized, by putting them in separate impl blocks. This also helps with the organization of the documentation. Makes the various methods much easier to overview and discover. For an example, take a look at what egui is doing with its Ui type: https://docs.rs/egui/latest/egui/struct.Ui.html Image

However, if we collapse all the impl blocks, the documentation becomes much harder to overview.

Image

Rustdoc could help the user out here by displaying the first line of the documentation for each collapsed impl block.

Concept art cobbled together in GIMP: Image

Moreover, there should be an easy way to collapse all impl blocks for easy overview. Currently, all impl blocks have to be collapsed manually one-by-one. The "collapse all docs" button ignores impl blocks.

emilk commented 1 month ago

Nice idea - maybe something for @GuillaumeGomez? :)

GuillaumeGomez commented 1 month ago

The idea sounds nice. Will need to talk about it with the rest of the team.

GuillaumeGomez commented 4 weeks ago

We just discussed it in rustdoc meeting and all present members agreed that it was a good idea. We will (hopefully I will have some time next week) try to implement it in the near future.

GuillaumeGomez commented 2 weeks ago

Implementation done. Cleaning up and then time to open the PR.