Skip to content

Commit d293267

Browse files
authored
Merge pull request #131 from cuviper/shredded-potatoes
Switch to hashbrown's RawTable internally
2 parents 8973b0f + 1999fa2 commit d293267

File tree

10 files changed

+904
-1361
lines changed

10 files changed

+904
-1361
lines changed

.travis.yml

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ language: rust
22
sudo: false
33
matrix:
44
include:
5-
# MSRV is lower for non-dev builds
6-
- rust: 1.18.0
7-
env:
8-
- SKIP_TEST=1
95
- rust: 1.32.0
106
- rust: 1.34.2
117
- rust: stable

Cargo.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "indexmap"
3-
version = "1.4.0"
3+
version = "1.5.0"
44
authors = [
55
"bluss",
66
"Josh Stone <[email protected]>"
@@ -35,8 +35,13 @@ autocfg = "1"
3535
serde = { version = "1.0", optional = true, default-features = false }
3636
rayon = { version = "1.0", optional = true }
3737

38+
[dependencies.hashbrown]
39+
version = "0.8.1"
40+
default-features = false
41+
features = ["raw"]
42+
3843
[dev-dependencies]
39-
itertools = "0.8"
44+
itertools = "0.9"
4045
rand = {version = "0.7", features = ["small_rng"] }
4146
quickcheck = { version = "0.9", default-features = false }
4247
fnv = "1.0"

README.rst

+22-9
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ indexmap
1212
.. |docs| image:: https://docs.rs/indexmap/badge.svg
1313
.. _docs: https://docs.rs/indexmap
1414

15-
.. |rustc| image:: https://img.shields.io/badge/rust-1.18%2B-orange.svg
16-
.. _rustc: https://img.shields.io/badge/rust-1.18%2B-orange.svg
15+
.. |rustc| image:: https://img.shields.io/badge/rust-1.32%2B-orange.svg
16+
.. _rustc: https://img.shields.io/badge/rust-1.32%2B-orange.svg
1717

18-
A safe, pure-Rust hash table which preserves (in a limited sense) insertion
19-
order.
18+
A pure-Rust hash table which preserves (in a limited sense) insertion order.
2019

2120
This crate implements compact map and set data-structures,
2221
where the iteration order of the keys is independent from their hash or
@@ -45,11 +44,6 @@ was indexmap, a hash table that has following properties:
4544
- It's the usual backwards shift deletion, but only on the index vector, so
4645
it's cheaper because it's moving less memory around.
4746

48-
Does not implement (Yet)
49-
------------------------
50-
51-
- ``.reserve()`` exists but does not have a complete implementation
52-
5347
Performance
5448
-----------
5549

@@ -86,6 +80,25 @@ which is roughly:
8680
Recent Changes
8781
==============
8882

83+
- 1.5.0
84+
85+
- **MSRV**: Rust 1.32 or later is now required.
86+
87+
- The inner hash table is now based on ``hashbrown`` by @cuviper in PR 131_.
88+
This also completes the method ``reserve`` and adds ``shrink_to_fit``.
89+
90+
- Add new methods ``get_key_value``, ``remove_entry``, ``swap_remove_entry``,
91+
and ``shift_remove_entry``, by @cuviper in PR 136_
92+
93+
- ``Clone::clone_from`` reuses allocations by @cuviper in PR 125_
94+
95+
- Add new method ``reverse`` by @linclelinkpart5 in PR 128_
96+
97+
.. _125: https://github.com/bluss/indexmap/pull/125
98+
.. _128: https://github.com/bluss/indexmap/pull/128
99+
.. _131: https://github.com/bluss/indexmap/pull/131
100+
.. _136: https://github.com/bluss/indexmap/pull/136
101+
89102
- 1.4.0
90103

91104
- Add new method ``get_index_of`` by @Thermatrix in PR 115_ and 120_

src/lib.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// We *mostly* avoid unsafe code, but `map::core::raw` allows it to use `RawTable` buckets.
12
#![deny(unsafe_code)]
23
#![doc(html_root_url = "https://docs.rs/indexmap/1/")]
34
#![cfg_attr(not(has_std), no_std)]
@@ -53,9 +54,8 @@
5354
//!
5455
//! ### Rust Version
5556
//!
56-
//! This version of indexmap requires Rust 1.18 or later, or 1.32+ for
57-
//! development builds, and Rust 1.36+ for using with `alloc` (without `std`),
58-
//! see below.
57+
//! This version of indexmap requires Rust 1.32 or later, or Rust 1.36+ for
58+
//! using with `alloc` (without `std`), see below.
5959
//!
6060
//! The indexmap 1.x release series will use a carefully considered version
6161
//! upgrade policy, where in a later 1.x version, we will raise the minimum
@@ -80,9 +80,10 @@
8080
//! [def]: map/struct.IndexMap.html#impl-Default
8181
8282
#[cfg(not(has_std))]
83-
#[macro_use(vec)]
8483
extern crate alloc;
8584

85+
extern crate hashbrown;
86+
8687
#[cfg(not(has_std))]
8788
pub(crate) mod std {
8889
pub use core::*;
@@ -106,8 +107,6 @@ mod mutable_keys;
106107
mod serde;
107108
mod util;
108109

109-
mod map_core;
110-
111110
pub mod map;
112111
pub mod set;
113112

@@ -129,8 +128,8 @@ struct HashValue(usize);
129128

130129
impl HashValue {
131130
#[inline(always)]
132-
fn get(self) -> usize {
133-
self.0
131+
fn get(self) -> u64 {
132+
self.0 as u64
134133
}
135134
}
136135

0 commit comments

Comments
 (0)