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

Include "length" in the documentation for Vec::len(), slice::len() etc. #37866

Closed
mystor opened this issue Nov 18, 2016 · 3 comments
Closed

Include "length" in the documentation for Vec::len(), slice::len() etc. #37866

mystor opened this issue Nov 18, 2016 · 3 comments
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools

Comments

@mystor
Copy link
Contributor

mystor commented Nov 18, 2016

This ensures that someone looking at the Vec documentation who searches for the word "length" to find the method which returns the length of the method will be able to find the method, and also explains the origin of the name if someone is unaware.

I bring this up because one of my coworkers came to me asking for the name of the method, because they were having trouble finding it in the documentation.

@steveklabnik
Copy link
Member

The problem with this is that it's generally bad to include this in the summary, as it's just repeating what's already been said. So I didn't do this on purpose.

I'm not sure what exact text rustdoc searches though.... i'd be against putting this in the summary, but for putting it in the longer description

@ollie27
Copy link
Member

ollie27 commented Nov 18, 2016

We seem to be very inconsistent about what summaries to use for len() methods: https://doc.rust-lang.org/nightly/std/?search=len. Some say "length" and some say "number of elements". Perhaps changing them all to say something like "Returns the number of elements in / length of the slice." would help here.

@bluss
Copy link
Member

bluss commented Nov 23, 2016

It doesn't need to be in the summary(?), it can be in the body of the doc. Searching for length already finds slice::len and Vec::len and so on, so the focus is simply in Ctrl+F search inside the doc page itself (if I understand correctly?).

@steveklabnik steveklabnik removed the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Mar 10, 2017
@steveklabnik steveklabnik added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools and removed A-docs labels Mar 23, 2017
steveklabnik added a commit to steveklabnik/rust that referenced this issue Apr 24, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 24, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 24, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 24, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 25, 2017
arielb1 pushed a commit to arielb1/rust that referenced this issue Apr 25, 2017
arielb1 pushed a commit to arielb1/rust that referenced this issue Apr 25, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 26, 2017
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
Projects
None yet
Development

No branches or pull requests

4 participants