Commit b6b98ea
authored
Auto merge of #37728 - QuietMisdreavus:rustdoc-enum-struct, r=GuillaumeGomez
rustdoc: fold fields for enum struct variants into a docblock
Per discussion in #37500, this PR updates the enum rendering code to wrap variants with named struct fields in a `docblock` span that is hidden automatically upon load of the page. This gives struct variant fields a clean separation from other enum variants, giving a boost to the readability of such documentation. Preview output is available [on the issue page](#37500 (comment)), but for the sake of completeness I'll include the images here again.

When you initially load the page, there's a line under variants with struct fields letting you know you can click to expand the listing.

If you click to expand, the header and table unfold into a nicely-indented listing.
If you want to take a look in your own browser and screen size, [I've got this version hosted on my server](https://shiva.icesoldier.me/doctest/doctest/enum.OldTopicRemoval.html).
Fixes #37500
r? @GuillaumeGomez3 files changed
+32
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2488 | 2488 | | |
2489 | 2489 | | |
2490 | 2490 | | |
2491 | | - | |
2492 | | - | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
2493 | 2498 | | |
2494 | 2499 | | |
2495 | 2500 | | |
| |||
2513 | 2518 | | |
2514 | 2519 | | |
2515 | 2520 | | |
2516 | | - | |
| 2521 | + | |
2517 | 2522 | | |
2518 | 2523 | | |
2519 | 2524 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1013 | 1013 | | |
1014 | 1014 | | |
1015 | 1015 | | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
1016 | 1032 | | |
1017 | 1033 | | |
1018 | 1034 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
342 | 346 | | |
343 | 347 | | |
344 | 348 | | |
| |||
671 | 675 | | |
672 | 676 | | |
673 | 677 | | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
674 | 682 | | |
675 | 683 | | |
676 | 684 | | |
| |||
0 commit comments