-
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
Doc Guarantee: BTree(Set|Map): IntoIter
Iterate in Sorted by key Order
#122817
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Nilstrieb (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is already guaranteed for all other iterators and pretty obvious so I'll just approve it without asking libs-api.
there are top level docs
Iterators obtained from functions such as BTreeMap::iter, BTreeMap::values, or BTreeMap::keys produce their items in order by key, and take worst-case logarithmic and amortized constant time per item returned.
can you add into_iter there too?
Added it to both Map and Set, with Set it previously only mentioned iter, I used "and" to include into_iter, which should be accurate because theres no keys/values etc methods in BTreeSet, so there shouldn't be confusion about only mentioning those two methods and using a closed joiner |
@bors r=@Nilstrieb rollup |
…lstrieb Doc Guarantee: BTree(Set|Map): `IntoIter` Iterate in Sorted by key Order This Doc-only PR adds text to the IntoIterator implementation and IntoIter type for both BTreeMap and BTreeSet that states that the returned items will be in sorted-by-key order, this is a guarantee that is made by the iter() and iter_mut() methods of BTreeMap/Set and BTreeMap respectively, but not on into_iter methods or types. I don't know how the IntoIter iteration would not be sorted by key, and I would like to rely on that behavior for my prefix_array crate. The text appended to IntoIter documentation is based on each types respective iter() method documentation, as is the text used in the IntoIterator documentation; they are slightly inconsistent between Set/Map, but they are consistent within their own types documentation.
…lstrieb Doc Guarantee: BTree(Set|Map): `IntoIter` Iterate in Sorted by key Order This Doc-only PR adds text to the IntoIterator implementation and IntoIter type for both BTreeMap and BTreeSet that states that the returned items will be in sorted-by-key order, this is a guarantee that is made by the iter() and iter_mut() methods of BTreeMap/Set and BTreeMap respectively, but not on into_iter methods or types. I don't know how the IntoIter iteration would not be sorted by key, and I would like to rely on that behavior for my prefix_array crate. The text appended to IntoIter documentation is based on each types respective iter() method documentation, as is the text used in the IntoIterator documentation; they are slightly inconsistent between Set/Map, but they are consistent within their own types documentation.
Rollup of 6 pull requests Successful merges: - rust-lang#121881 (std::net: adding acceptfilter feature for netbsd/freebsd.) - rust-lang#122817 (Doc Guarantee: BTree(Set|Map): `IntoIter` Iterate in Sorted by key Order) - rust-lang#122829 (Implement `FusedIterator` for `gen` block) - rust-lang#122831 (make failure logs less verbose) - rust-lang#122837 (add test for rust-lang#122549) - rust-lang#122838 (Avoid noop rewrite of issues.txt) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#121881 (std::net: adding acceptfilter feature for netbsd/freebsd.) - rust-lang#122817 (Doc Guarantee: BTree(Set|Map): `IntoIter` Iterate in Sorted by key Order) - rust-lang#122826 (Add tests for shortcomings of associated type bounds) - rust-lang#122829 (Implement `FusedIterator` for `gen` block) - rust-lang#122831 (make failure logs less verbose) - rust-lang#122837 (add test for rust-lang#122549) - rust-lang#122838 (Avoid noop rewrite of issues.txt) - rust-lang#122841 (add 2 more tests for issues fixed by rust-lang#122749) - rust-lang#122843 (Add a never type option to make diverging blocks `()`) - rust-lang#122844 (add test for ice "cannot relate region: LUB(ReErased, ReError)") - rust-lang#122845 (Clippy subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#122817 - ultrabear:ultrabear_btreedoc, r=Nilstrieb Doc Guarantee: BTree(Set|Map): `IntoIter` Iterate in Sorted by key Order This Doc-only PR adds text to the IntoIterator implementation and IntoIter type for both BTreeMap and BTreeSet that states that the returned items will be in sorted-by-key order, this is a guarantee that is made by the iter() and iter_mut() methods of BTreeMap/Set and BTreeMap respectively, but not on into_iter methods or types. I don't know how the IntoIter iteration would not be sorted by key, and I would like to rely on that behavior for my prefix_array crate. The text appended to IntoIter documentation is based on each types respective iter() method documentation, as is the text used in the IntoIterator documentation; they are slightly inconsistent between Set/Map, but they are consistent within their own types documentation.
This Doc-only PR adds text to the IntoIterator implementation and IntoIter type for both BTreeMap and BTreeSet that states that the returned items will be in sorted-by-key order, this is a guarantee that is made by the iter() and iter_mut() methods of BTreeMap/Set and BTreeMap respectively, but not on into_iter methods or types.
I don't know how the IntoIter iteration would not be sorted by key, and I would like to rely on that behavior for my prefix_array crate.
The text appended to IntoIter documentation is based on each types respective iter() method documentation, as is the text used in the IntoIterator documentation; they are slightly inconsistent between Set/Map, but they are consistent within their own types documentation.