-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustdoc: Merge "Structs", "Enums", "Unions", and "Type Definitions" sections on module pages #92656
Comments
cc @jsha |
Terrific idea! |
I'm not completely sold on the idea. Something about it is bothering me but I can't put the finger on it... Well, for now let's say I'm neutral. |
I find the current layout simpler than what's being proposed here. I can understand the reasoning behind it, but each kind of type is fundamentally different in a way where it's quite useful to see them laid out separately. |
I understand that the intent here is to simplify the sidebar and make things seem less verbose, but (particularly relating to type definitions) I'm not really a fan of the change. It can be very helpful to know when something falls into a specific "class" of type - without having to jump to its position in the documentation or inspect the source - and I would really hate to lose that. I wouldn't be opposed to making it some sort of a configurable option, but I do think such a proposal does more harm to documentation than good. I suppose one alternative would be to merge them into a |
I support what @kaylynn234 suggests. I feel like doing this would be counterproductive. I've found that I've had many cases where I need to looking over a module and need to find a specific enum or struct but don't remember the name. And I can't necessarily search for it with Take, for example, an AST module. If designed in a certain way, e.g. Rust's AST/HIR, it will have main structures For most people, this change will probably not have much effect. But for me, it honestly would likely decrease my ability to navigate certain docs, especially in my programming language projects. I've already found that removing the color difference between structs and enums and etc. (from #91480) has impacted my ability to navigate through documentation. While I'll likely get used to this, combining the sections would amplify this problem. |
Hmm, okay. I won't make this change then. What about just moving the sections so they're all next to each other? Currently, the type alias section is at the bottom, while the others are at the top. Instead, I think they should all be at the top. |
I don’t think type definitions should be grouped with the rest, it’s often important to know that you’re dealing with a type synonym, in particular for custom versions of I’m not sure yet how to feel about (Most) primitive types would also become “plain”, i.e. grouped with enums. E.g. Anyways, simply merging structs and enums seems reasonable to me, too, unlike merging them with type synonyms/aliases. |
FWIW, I'm still in favor of merging the sections. Yes, enums and structs are not exactly the same. But attention is a finite resource. By merging, we focus people on the big, important distinctions (between concrete types, traits, functions, macros and modules) rather than the less important ones - at least at the module summary page level. The pages and hover text will of course always make it clear whether something is an enum or a struct. |
I do like the idea of just merging structs and enums. However, if we merge them but not type aliases, what would we call the section? "Algebraic data types" comes to mind, but that's a mouthful and would likely confuse new users. |
@camelid Just “data types”? |
Perhaps. People may get confused that "data types" don't include type aliases though 🤷 |
Hmm, maybe just "types" and "type aliases" would be clear enough. |
I apologize for being blunt here, but you're missing the mark entirely. You're absolutely right that attention is a finite resource, but merging these sections (and making them all the same color) requires more attention, not less. When I'm searching for an enum, now I have to read through a much larger section and there is no longer any way to see what enums are available. You're forcing people with reading difficulties to read more instead of less. Having common items grouped together and color coded allows people to use visual cues to narrow down the amount of text that they need to process. |
Could you elaborate on in what kinds of situations you'd be looking for an enum in particular, rather than any kind of type? I think that would help me understand your use case better. |
For example, I want to select an adapter based on a particular device API. I remember that this is a flag, so it's likely an enum, but I can't remember it's name. I scroll down until I see green and then start checking the items. I find https://docs.rs/wgpu/0.12.0/wgpu/ When you ask about looking for an enum in particular, why is enum being treated any differently than structs or traits? Why not merge all of the sections into one giant section and color code them all the same way? Why do we have groupings or visual cues at all? Let's take a step back and try to understand what problem we're trying to solve here. We want to make items more discoverable and easier to narrow down. Groups, color cues, and distinctive sections allow you to do that without having to read though large chunks of text. |
FYI I already asked for all those sections to be merged into a single one in #64454. I understand that not everyone thinks the same way I do, so I'm not going to claim either way requires less or more attention than the other, and neither should anyone else. |
I think of structs and enums as being very similar (they're both algebraic data types), and in fact, in languages related to Rust like Haskell and OCaml, the same language feature is used to represent both structs and enums. So I think of them as belonging to the same category, whereas traits are a different concept (behavior rather than data). |
I'll close this issue since it seems many people prefer the current design. |
Summary
Merge the following sections that appear on module (and crate) pages into a single "Types" section:
Why?
The text was updated successfully, but these errors were encountered: