summary refs log tree commit diff
path: root/src/libstd/collections/hash/map.rs
AgeCommit message (Collapse)AuthorLines
2017-10-06Auto merge of #44734 - mchlrhw:wip/hashmap-entry-and-then, r=BurntSushibors-0/+35
Implement `and_modify` on `Entry` ## Motivation `Entry`s are useful for allowing access to existing values in a map while also allowing default values to be inserted for absent keys. The existing API is similar to that of `Option`, where `or` and `or_with` can be used if the option variant is `None`. The `Entry` API is, however, missing an equivalent of `Option`'s `and_then` method. If it were present it would be possible to modify an existing entry before calling `or_insert` without resorting to matching on the entry variant. Tracking issue: https://github.com/rust-lang/rust/issues/44733.
2017-10-06Implement `entry_and_modify`mchlrhw-0/+35
2017-10-05Auto merge of #44943 - nivkner:fixme_fixup, r=dtolnaybors-3/+3
address some FIXME whose associated issues were marked as closed part of #44366
2017-09-30address some `FIXME`s whose associated issues were marked as closedNiv Kaminer-3/+3
remove FIXME(#13101) since `assert_receiver_is_total_eq` stays. remove FIXME(#19649) now that stability markers render. remove FIXME(#13642) now the benchmarks were moved. remove FIXME(#6220) now that floating points can be formatted. remove FIXME(#18248) and write tests for `Rc<str>` and `Rc<[u8]>` remove reference to irelevent issues in FIXME(#1697, #2178...) update FIXME(#5516) to point to getopts issue 7 update FIXME(#7771) to point to RFC 628 update FIXME(#19839) to point to issue 26925
2017-09-29Rollup merge of #44794 - napen123:master, r=frewsxcvMark Simulacrum-0/+11
Add doc example to HashMap::hasher None
2017-09-28Auto merge of #44278 - Binero:master, r=BurntSushibors-0/+30
Allow replacing HashMap entries This is an obvious API hole. At the moment the only way to retrieve an entry from a `HashMap` is to get an entry to it, remove it, and then insert a new entry. This PR allows entries to be replaced.
2017-09-24Add doc example to HashMap::hasherEthan Dagner-0/+11
2017-09-15HashMap::new and HashSet::new do not allocateJon Gjengset-0/+3
2017-09-12Addressed @BurntSuchi's remarks regarding Entry::replaceJeroen Bollen-4/+3
2017-09-05Avoid weird or_insert_with exampleJon Gjengset-3/+1
2017-09-05Add or_default to Entry APIsJon Gjengset-0/+29
2017-09-03Marked `Entry::replace` as unstable.Jeroen Bollen-1/+2
2017-09-03Added a way to retrieve the key out of a HashMap when it's being replaced.Jeroen Bollen-0/+30
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-9/+9
Like #43008 (f668999), but _much more aggressive_.
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-1/+1
2017-07-23Fix some doc/comment typos.Bruce Mitchener-1/+1
2017-07-06Add annotations to the resize fn #39791Ryan Thomas-0/+2
This adds the `inline(never)` and `cold` annotations to the HashMap::resize function.
2017-06-23Relax Debug constraints when debugging {HashMap,BTreeMap}::{Keys,Values}.Federico Ravasio-2/+2
Fixed #41924.
2017-06-21Impl Clone for DefaultHasherLeonardo Yvens-1/+1
2017-05-20Stabilize library features for 1.18.0Steven Fackler-2/+1
Closes #38863 Closes #38980 Closes #38903 Closes #36648
2017-04-23Auto merge of #41437 - cuviper:remove-unstable-deprecated, r=alexcrichtonbors-7/+0
Remove items that are unstable and deprecated This removes unstable items that have been deprecated for more than one cycle. - Since 1.16.0, `#![feature(enumset)]` - All of `mod collections::enum_set` - Since 1.15.0, `#![feature(borrow_state)]` - `cell::BorrowState` - `RefCell::borrow_state()` - Since 1.15.0, `#![feature(is_unique)]` - `Rc::is_unique()` (made private like `Arc::is_unique()`) - Since 1.15.0, `#![feature(rc_would_unwrap)]` - `Rc::would_wrap()` - Since 1.13.0, `#![feature(binary_heap_extras)]` - `BinaryHeap::push_pop()` - `BinaryHeap::replace()` - Since 1.12.0, `#![feature(as_unsafe_cell)]` - `Cell::as_unsafe_cell()` - `RefCell::as_unsafe_cell()` - Since 1.12.0, `#![feature(map_entry_recover_keys)]` - `btree_map::OccupiedEntry::remove_pair()` - `hash_map::OccupiedEntry::remove_pair()` - Since 1.11.0, `#![feature(float_extras)]` - `Float::nan()` - `Float::infinity()` - `Float::neg_infinity()` - `Float::neg_zero()` - `Float::zero()` - `Float::one()` - `Float::integer_decode()` - `f32::integer_decode()` - `f32::ldexp()` - `f32::frexp()` - `f32::next_after()` - `f64::integer_decode()` - `f64::ldexp()` - `f64::frexp()` - `f64::next_after()` - Since 1.11.0, `#![feature(zero_one)]` - `num::Zero` - `num::One`
2017-04-22Fix invalid linkageGuillaume Gomez-1/+1
2017-04-20Remove OccupiedEntry::remove_pairJosh Stone-7/+0
[unstable, deprecated since 1.12.0]
2017-04-13Various consistency and phrasing fixes in std::collections' docslukaramu-8/+8
* Changed btree_map's and hash_map's Entry (etc.) docs to be consistent * Changed VecDeque's type and module summary sentences to be consistent with each other as well as with other summary sentences in the module * Changed HashMap's and HashSet's summary sentences to be less redundantly phrased and also more consistant with the other summary sentences in the module * Also, added an example to Bound
2017-04-13Various fixes throughout std::collections' docslukaramu-18/+19
* Added links where possible (limited because of facading) * Changed references to methods from `foo()` to `foo` in module docs * Changed references to methods from `HashMap::foo` to just `foo` in top-level docs for `HashMap` and the `default` doc for `DefaultHasher` * Various small other fixes
2017-04-13Update std::collections' docs to use iterator (etc.) boilerplatelukaramu-7/+49
This greatly improves consistency.
2017-04-04Simplify HashMap Bucket interfacearthurprs-18/+14
* Store capacity_mask instead of capacity * Move bucket index into RawBucket * Bucket index is now always within [0..table_capacity) * Clone RawTable using RawBucket * Simplify iterators by moving logic into RawBuckets * Make retain aware of the number of elements
2017-03-17Fix a spelling error in HashMap documentation, and slightly reword it to be ↵Jeff Walden-2/+2
more precise.
2017-03-11Implement placement-in protocol for `HashMap`Charlie Fan-5/+155
2017-03-03Reduce size overhead of adaptative hashmaparthurprs-16/+8
Exposes a boolean flag in RawTable and use it instead of a bool field in HashMap. Fixes: #40042
2017-02-20Simplify adaptive hashmaparthurprs-23/+11
2017-02-18Fix spelling in commentsarthurprs-5/+5
2017-02-16Resize hashmap when long probes are detectedarthurprs-12/+105
2017-02-15Rollup merge of #39839 - king6cong:refine-doc, r=frewsxcvCorey Farwell-1/+1
make doc consistent with var name
2017-02-15Auto merge of #39560 - F001:retainHashMap, r=alexcrichtonbors-39/+75
std: Add retain method for HashMap and HashSet Fix #36648 r? @bluss
2017-02-15make doc consistent with var nameking6cong-1/+1
2017-02-08std: Add retain method for HashMap and HashSetf001-39/+75
Fix #36648
2017-02-05Rollup merge of #39393 - ollie27:stab_impls, r=alexcrichtonCorey Farwell-8/+8
Fix a few impl stability attributes The versions show up in rustdoc.
2017-02-03Add missing urls in HashMapGuillaume Gomez-5/+12
2017-01-29Fix a few impl stability attributesOliver Middleton-8/+8
The versions show up in rustdoc.
2017-01-13Change `to_owned` to `to_string` in docsStjepan Glavina-2/+2
We should teach conversion from `str` to `String` using `to_string` rather than the legacy `to_owned`.
2016-12-18Implement `fmt::Debug` for all structures in libstd.Corey Farwell-2/+81
Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-12-07Rollup merge of #38186 - frewsxcv:default, r=GuillaumeGomezGuillaume Gomez-0/+4
Add docs for last undocumented `Default` `impl`. Add doc comment for `Default` `impl` on `DefaultHasher`. Fixes https://github.com/rust-lang/rust/issues/36265.
2016-12-06Add doc comment for `Default` `impl` on `DefaultHasher`.Corey Farwell-0/+4
2016-12-06Auto merge of #38017 - arthurprs:hm-extend, r=blussbors-4/+13
Smarter HashMap/HashSet pre-allocation for extend/from_iter HashMap/HashSet from_iter and extend are making totally different assumptions. A more balanced decision may allocate half the lower hint (rounding up). For "well defined" iterators this effectively limits the worst case to two resizes (the initial reserve + one resize). cc #36579 cc @bluss
2016-12-06Smarter HashMap/HashSet extendarthurprs-4/+13
2016-11-27Use displacement instead of initial bucket in HashMap codearthurprs-18/+21
2016-10-31Don't reuse RandomState seedsarthurprs-14/+12
2016-10-06Auto merge of #36753 - srinivasreddy:hash, r=nrcbors-184/+264
run rustfmt on libstd/collections/hash folder
2016-10-04Rollup merge of #36902 - ollie27:stab_impls, r=alexcrichtonManish Goregaokar-3/+3
std: Correct stability attributes for some implementations These are displayed by rustdoc so should be correct.