Skip to content
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

Documentation for Implemented Traits Confusing for Beginners #66784

Open
zwhitchcox opened this issue Nov 26, 2019 · 3 comments
Open

Documentation for Implemented Traits Confusing for Beginners #66784

zwhitchcox opened this issue Nov 26, 2019 · 3 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-traits Area: Trait system C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@zwhitchcox
Copy link

I posted in Reddit about a method that seemed to be missing in the Range documentation, and it was explained to me that this method (map) came from a different trait called Iterator.

Most people seemed to know this, but when asked how I would find this information if I didn't know every method on every trait that Range implemented, no one seemed to have a good answer.

The first way was to expand all the information about all the traits. Only the "expand all" button doesn't really expand everything, but just what someone seems to have determined is important, which did not include the map method.

So, then the next step, which was to manually expand every single method of every single trait that was implemented for Range.

This brings us to my first point. The expand everything button should actually expand everything.

There should also be a search box that allows you to search for the methods the trait implements. You could practically get this for free, as the info seems to already be downloaded to the page. I can see no reason why a search feature would not be implemented, especially in light of the fact that you can't do a search on the page with Ctrl+F due to everything being hidden and no easy way to expand everything.

The second point is that there should only be methods that are actually implemented for the actual struct of the page I am on. If a struct doesn't implement a method of a trait that it implements, there is not reason for it to be on that page other than to confuse people.

I get the feeling that people have worked with Rust for so long that they know all this stuff by heart, but for a beginner, this is very confusing, and it also doesn't scale once people start implementing their own structs that people won't have memorized.

To be honest, this is almost enough to make me leave the language. I will probably just wait to learn it until proper documentation is implemented though. If I can't deterministically tell what method will do what, how am I supposed to use this language to code?

But think about how awesome it would be if you could just go a struct's documentation page and just scroll through and see every method implemented for the struct and only methods actually implemented?

@jyn514

This comment has been minimized.

@pietroalbini pietroalbini transferred this issue from rust-lang/docs.rs Nov 26, 2019
@pietroalbini

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Nov 27, 2019
@the8472
Copy link
Member

the8472 commented Nov 27, 2019

The second point is that there should only be methods that are actually implemented for the actual struct of the page I am on. If a struct doesn't implement a method of a trait that it implements, there is not reason for it to be on that page other than to confuse people.

Quite the opposite has been requested before. Sometimes people just want a list overview of available methods and their signatures on a struct and care less which trait impl or deref coercion they come from.

#61190 #40273

@JohnTitor JohnTitor added A-traits Area: Trait system C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Feb 2, 2020
@jonas-schievink jonas-schievink added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-traits Area: Trait system C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants