about summary refs log tree commit diff
path: root/library/alloc/src/collections/btree/map.rs
AgeCommit message (Collapse)AuthorLines
2021-02-06BTreeMap: remove Ord bound where it is absent elsewhereStein Somers-13/+4
2021-02-06BTreeMap: fix documentation of unstable public membersStein Somers-15/+17
2021-02-06Rollup merge of #81610 - ssomers:btree_emphasize_ord_bound, r=dtolnayMara Bos-26/+70
BTreeMap: make Ord bound explicit, compile-test its absence Most `BTreeMap` and `BTreeSet` members are subject to an `Ord` bound but a fair number of methods are not. To better convey and perhaps later tune the `Ord` bound, make it stand out in individual `where` clauses, instead of once far away at the beginning of an `impl` block. This PR does not introduce or remove any bounds. Also adds compilation test cases checking that the bound doesn't creep in unintended on the historically unbounded methods.
2021-02-02BTreeMap: make Ord bound explicit, compile-test its absenceStein Somers-26/+70
2021-01-31Add doc aliases for "delete"Konrad Borowski-0/+1
This patch adds doc aliases for "delete". The added aliases are supposed to reference usages `delete` in other programming languages. - `HashMap::remove`, `BTreeMap::remove` -> `Map#delete` and `delete` keyword in JavaScript. - `HashSet::remove`, `BTreeSet::remove` -> `Set#delete` in JavaScript. - `mem::drop` -> `delete` keyword in C++. - `fs::remove_file`, `fs::remove_dir`, `fs::remove_dir_all` -> `File#delete` in Java, `File#delete` and `Dir#delete` in Ruby. Before this change, searching for "delete" in documentation returned no results.
2021-01-29btree: use Option's unwrap_unchecked()Miguel Ojeda-6/+5
Now that https://github.com/rust-lang/rust/issues/81383 is available, start using it. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-01-26BTreeMap: stop tree from being owned by non-root nodeStein Somers-3/+3
2021-01-24BTreeMap: lightly refactor the split_off implementationStein Somers-12/+12
2021-01-18BTreeMap: convert search functions to methodsStein Somers-9/+9
2021-01-16Clarify what the effects of a 'logic error' areChris Jefferson-0/+3
2020-12-28Add "length" as doc alias to len methodsKonrad Borowski-0/+1
2020-12-17BTreeMap: relax the explicit borrow rule to make code shorter and saferStein Somers-1/+1
2020-11-24Rollup merge of #79358 - ssomers:btree_public_comments, r=Mark-SimulacrumJonas Schievink-2/+2
BTreeMap/BTreeSet: make public doc more consistent Tweaks #72876 and #73667 and propagate them to `BTreeSet`.
2020-11-23BTreeMap/BTreeSet: make public doc more consistentStein Somers-2/+2
2020-11-23doc typooliver-2/+2
plus a small edit for clarity
2020-11-22BTreeMap: swap the names of NodeRef::new and Root::new_leafStein Somers-8/+8
2020-11-21More consistently use spaces after commas in lists in docsCarol (Nichols || Goulding)-1/+1
2020-11-18BTreeMap: reuse NodeRef as Root, keep BoxedNode for edges only, ban UniqueStein Somers-22/+22
2020-11-13Add BTreeMap::retain and BTreeSet::retainMatt Brubeck-0/+24
2020-11-08BTreeMap: split off most code of append, slightly improve interfacesStein Somers-94/+2
2020-10-30Constantify more BTreeMap and BTreeSet functionsBenoît du Garreau-2/+4
- BTreeMap::len - BTreeMap::is_empty - BTreeSet::len - BTreeSet::is_empty
2020-10-25Auto merge of #78015 - ssomers:btree_merge_mergers, r=Mark-Simulacrumbors-24/+11
btree: merge the implementations of MergeIter Also remove the gratuitous Copy bounds. Same benchmark performance. r? `@Mark-Simulacrum`
2020-10-24BTreeMap: stop mistaking node::MIN_LEN as a node level constraintStein Somers-2/+6
2020-10-22BTreeMap/Set: merge the implementations of MergeIterStein Somers-24/+11
2020-10-18BTreeMap: split off most code of remove and split_offStein Somers-222/+1
2020-10-12BTreeMap: refactor Entry out of map.rs into its own fileJacob Hughes-468/+5
btree/map.rs is approaching the 3000 line mark, splitting out the entry code buys about 500 lines of headroom
2020-10-08Rollup merge of #77449 - ssomers:btree_drain_filter_size_hint, r=Mark-SimulacrumJonas Schievink-0/+4
BTreeMap: comment why drain_filter's size_hint is somewhat pessimistic The `size_hint` of the `DrainFilter` iterator doesn't adjust as you iterate. This hardly seems important to me, but there has been a comparable PR #64383 in the past. I guess a scenario is that you first iterate half the map manually and keep most of the key/value pairs in the map, and then tell the predicate to drain most of the key/value pairs and `.collect` the iterator over the remaining half of the map. I am totally ambivalent whether this is better or not. r? @Mark-Simulacrum
2020-10-04Rollup merge of #77447 - ssomers:btree_cleanup_8, r=Mark-SimulacrumYuki Okushi-2/+6
BTreeMap: document DrainFilterInner better r? @Mark-Simulacrum
2020-10-03BTreeMap: comment why drain_filter's size_hint is somewhat pessimistictidStein Somers-0/+4
2020-10-03Rollup merge of #75377 - canova:map_debug_impl, r=dtolnayJonas Schievink-7/+51
Fix Debug implementations of some of the HashMap and BTreeMap iterator types HashMap's `ValuesMut`, BTreeMaps `ValuesMut`, IntoValues and `IntoKeys` structs were printing both keys and values on their Debug implementations. But they are iterators over either keys or values. Irrelevant values should not be visible. With this PR, they only show relevant fields. This fixes #75297. [Here's an example code.](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=0c79356ed860e347a0c1a205616f93b7) This prints this on nightly: ``` ValuesMut { inner: IterMut { range: [(1, "hello"), (2, "goodbye")], length: 2 } } IntoKeys { inner: [(1, "hello"), (2, "goodbye")] } IntoValues { inner: [(1, "hello"), (2, "goodbye")] } [(2, "goodbye"), (1, "hello")] ``` After the patch this example prints these instead: ``` ["hello", "goodbye"] ["hello", "goodbye"] [1, 2] ["hello", "goodbye"] ``` I didn't add test cases for them, since I couldn't see any tests for Debug implementations anywhere. But please let me know if I should add it to a specific place. r? @dtolnay
2020-10-02BTreeMap: document DrainFilterInner betterStein Somers-2/+6
2020-09-27Use relative links instead of intra-doc linksJoshua Nelson-1/+1
Previously, `BTreeMap` tried to link to `crate::collections`, intending for the link to go to `std/collections/index.html`. But `BTreeMap` is defined in `alloc`, so after the fix in the previous commit, the links instead went to `alloc/collections/index.html`, which has almost no information. This changes it to link to `index.html`, which only works when viewing from `std::collections::BTreeMap`, the most common place to visit the docs. Fixing it to work from anywhere would require the docs for `std::collections` to be duplicated in `alloc::collections`, which in turn would require HashMap to be `alloc` for intra-doc links to work (https://github.com/rust-lang/rust/issues/74481).
2020-09-20Rollup merge of #76926 - ssomers:btree_cleanup_1, r=Mark-SimulacrumRalf Jung-1/+1
BTreeMap: code readability tweaks Gathered over the past months r? @Mark-Simulacrum
2020-09-19Use intra-doc linksDenis Vasilik-11/+7
2020-09-19BTreeMap: code readability tweaksStein Somers-1/+1
2020-09-10BTreeMap: pull the map's root out of NodeRefStein Somers-49/+72
2020-09-09BTreeMap: avoid aliasing by avoiding slicesStein Somers-2/+2
2020-08-19BTreeMap: introduce marker::ValMut and reserve marker::Mut for unique accessStein Somers-124/+10
2020-08-18BTreeMap: check some invariants, avoid recursion in depth first searchStein Somers-32/+3
2020-08-15Auto merge of #75488 - ssomers:btree_revert_75257, r=Mark-Simulacrumbors-49/+20
Revert the fundamental changes in #74762 and #75257 Before possibly going over to #75487. Also contains some added and fixed comments. r? @Mark-Simulacrum
2020-08-14Rollup merge of #75531 - ssomers:btree_tests_migration, r=Mark-SimulacrumTyler Mandry-0/+3
Migrate unit tests of btree collections to their native breeding ground There's one BTreeSet test case that I couldn't easily convince to come along, maybe because it truly is an integration test. But leaving it in place would mean git wouldn't see the move so I also moved it to a new file. r? @Mark-Simulacrum
2020-08-14Move btree unit test to their native, privileged locationStein Somers-0/+3
2020-08-13Reverts the fundamental changes in #74762 and #75257Stein Somers-49/+20
2020-08-11BTreeMap: purge innocent use of into_kv_mutStein Somers-3/+3
2020-08-10Manually implement Debug for BTreeMap::ValuesMut structNazım Can Altınova-1/+24
Deriving debug prints all the values including keys. But ValuesMut struct should only print the values.
2020-08-10Manually implement Debug for BTreeMap::{IntoKeys,IntoValues} structsNazım Can Altınova-6/+27
2020-08-09BTreeMap: better distinguish the root holder from the root nodeStein Somers-33/+40
2020-08-08Auto merge of #75163 - canova:map_into_keys_values, r=dtolnaybors-0/+148
Implement `into_keys` and `into_values` for associative maps This PR implements `into_keys` and `into_values` for HashMap and BTreeMap types. They are implemented as unstable, under `map_into_keys_values` feature. Fixes #55214. r? @dtolnay
2020-08-08Update the tracking issue number of map_into_keys_valuesNazım Can Altınova-12/+12
2020-08-08Remove min/max values from IntoValues Iterator implementationNazım Can Altınova-8/+0