Skip to content

[rustdoc] Inline impl docstring headers when possible #144809

@crumblingstatue

Description

@crumblingstatue

#141663 Added a way to collapse all impl blocks, which is one step closer to a great reading experience when using separate impls for splitting up your API documentation.

However, the impl blocks are currently spaced too far apart for a comfortable overview.

Here is an example viewing the egui::Ui documentation:

Image

A possible improvement would be to determine (possibly using some kind of heuristic) if it's possible to inline the first paragraph or header of the doc string, and if so, inline it.

Here is a mockup made in an image editor:

Image

This would make it much easier to overview impls.

The heuristic can be conservative. For starters, maybe it could just trigger for the simple case of impl Item, without any generics or bounds, to make it simple to implement.

Metadata

Metadata

Assignees

Labels

A-rustdoc-uiArea: Rustdoc UI (generated HTML)T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions