-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
API Docs: collections #29348
Comments
What needs to be done here? Just cleanup? |
Yeah, overall, these bugs are like "Steve's eye of Sauron will check the entire standard library at least once." I haven't actually looked at collections' docs lately, but sample things are like:
I don't have any specific goals yet. |
As discussed on this Rust subreddit thread, I'll also try to help out by adding some more examples for using the entry API to update/modify a |
@steveklabnik Some things I've noticed that are relevant to this:
|
The blurb on complex keys in the map
It's the key that is not updated. The value is updated. The linked module-level documentation makes this clear. |
Responding to [a thread of discussion on the Rust subreddit](https://www.reddit.com/r/rust/comments/3racik/mutable_lifetimes_are_too_long_when_matching_an/), it was identified that the presence of the Entry API is not duly publicised. This commit aims to add some reasonable examples of common usages of this API to the main example secion of the `HashMap` documentation. This is part of issue rust-lang#29348.
@steveklabnik I've raised the above (long overdue!) PR, which you've been as quick as lightning and already looked at! Are there any other particular parts of the collection APIs that need attention in terms of examples, etc. that I can have a look at? Would be good to perhaps put together a checklist of stuff that needs some work so we can pick them off in bits. |
In general, every single method and function should have an example, as a baseline. I haven't dug into the collections docs in a while, so I don't have a ton of details about specifics right now, but that's at least the baseline. |
Okay awesome, I might start going through some of them and will add the ones I've checked back here for reference. 👍 |
That'd be spectacular. |
Okay, have been through the collection docs and here's the ones that need checking (ie. they actually have methods/functions and are not just trait implementations). I'm going to try and raise PRs separately for each of these things to add at least the missing examples for now. Top level structs:
Collection specific structs: |
…ntry-api, r=steveklabnik Responding to [a thread of discussion on the Rust subreddit](https://www.reddit.com/r/rust/comments/3racik/mutable_lifetimes_are_too_long_when_matching_an/), it was identified that the presence of the Entry API is not duly publicised. This commit aims to add some reasonable examples of common usages of this API to the main example secion of the `HashMap` documentation. This is part of issue rust-lang#29348.
…ntry-api, r=steveklabnik Responding to [a thread of discussion on the Rust subreddit](https://www.reddit.com/r/rust/comments/3racik/mutable_lifetimes_are_too_long_when_matching_an/), it was identified that the presence of the Entry API is not duly publicised. This commit aims to add some reasonable examples of common usages of this API to the main example secion of the `HashMap` documentation. This is part of issue rust-lang#29348.
As part of the ongoing effort to document all methods with examples, this commit adds the missing examples for the `BTreeMap` collection type. This is part of issue rust-lang#29348.
As part of the ongoing effort to document all methods with examples, this commit adds the missing examples for the `BTreeSet` collection type. This is part of issue rust-lang#29348.
As part of the ongoing effort to document all methods with examples, this commit adds the missing examples for the `BinaryHeap` collection type. This is part of issue rust-lang#29348.
…et, r=steveklabnik Add missing documentation examples for BTreeSet. As part of the ongoing effort to document all methods with examples, this commit adds the missing examples for the `BTreeSet` collection type. This is part of issue rust-lang#29348. r? @steveklabnik
…heap, r=steveklabnik Add missing documentation examples for BinaryHeap. As part of the ongoing effort to document all methods with examples, this commit adds the missing examples for the `BinaryHeap` collection type. This is part of issue rust-lang#29348. r? @steveklabnik
…et, r=steveklabnik Add missing documentation examples for BTreeSet. As part of the ongoing effort to document all methods with examples, this commit adds the missing examples for the `BTreeSet` collection type. This is part of issue rust-lang#29348. r? @steveklabnik
…heap, r=steveklabnik Add missing documentation examples for BinaryHeap. As part of the ongoing effort to document all methods with examples, this commit adds the missing examples for the `BinaryHeap` collection type. This is part of issue rust-lang#29348. r? @steveklabnik
…heap, r=steveklabnik Add missing documentation examples for BinaryHeap. As part of the ongoing effort to document all methods with examples, this commit adds the missing examples for the `BinaryHeap` collection type. This is part of issue rust-lang#29348. r? @steveklabnik
…teveklabnik Add examples for LinkedList Part of rust-lang#29348. r? @steveklabnik
…veklabnik Add examples for VecDeque Part of rust-lang#29348. r? @steveklabnik
…veklabnik Add doc for btree_map types Part of rust-lang#29348. r? @steveklabnik
…steveklabnik Add Random state doc Last part of rust-lang#29348. r? @steveklabnik
…eklabnik Add HashMap Entry enums examples Part of rust-lang#29348. r? @steveklabnik
…eklabnik Add HashMap Entry enums examples Part of rust-lang#29348. r? @steveklabnik
All done. |
I would like to reopen this issue since I think the documentation of the In particular, it lacks enough rigor to make informed decisions about using the collections and their methods. In my opinion, and independently of how repetitive it is, the documentation of each method should have the following "fields":
For a source of inspiration, the C++ standard is exemplary at documented all of these things. I really think that being more thorough with the documentation will help both find and fix bugs in the documentation and make the std library way better. So IMO what remains to be done is:
Another thing I've found is that not all collections are mentioned in the main collections page (e.g.
Some examples of the current state of things:
EDIT: I ran into this when I wanted to see if it made sense to use |
@gnzlbg: Good points. Since this issue is getting old, I propose to you to reopen it with your message directly. (and please cc me in it when it's done). |
Part of #29329
http://doc.rust-lang.org/std/collections/
This will probably need to be tackled in pieces.
The text was updated successfully, but these errors were encountered: