]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #37728 - QuietMisdreavus:rustdoc-enum-struct, r=GuillaumeGomez
authorbors <bors@rust-lang.org>
Sun, 13 Nov 2016 06:36:49 +0000 (22:36 -0800)
committerGitHub <noreply@github.com>
Sun, 13 Nov 2016 06:36:49 +0000 (22:36 -0800)
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](https://github.com/rust-lang/rust/issues/37500#issuecomment-260069269), but for the sake of completeness I'll include the images here again.

![rustdoc struct enum variant 4 part 1](https://cloud.githubusercontent.com/assets/5217170/20231925/96160b7e-a82a-11e6-945b-bbba95c5e4bc.PNG)

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.

![rustdoc struct enum variant 4 part 2](https://cloud.githubusercontent.com/assets/3050060/20232067/1dc63266-a866-11e6-9555-8fb1c8afdcec.png)

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? @GuillaumeGomez

1  2 
src/librustdoc/html/render.rs
src/librustdoc/html/static/rustdoc.css

Simple merge