slotmap
Slotmap data structure
1.1.1
96M downloads/mo
#822 most downloaded on crates.io
orlp/slotmap
What this package is like to depend on
Last release 8 months ago
06 Dec 2025
Release timing varies
gaps range from 8 days to 2.3 years
Most releases are documented
notes for 4 of 6 stable releases
15 versions withdrawn
withdrawn after publishing
8 years old
21 releases · first in 2018
2 releases in the last 12 months
see the full history below
Release timeline
21 releases · Jul 2018 to Dec 2025Releases
latest 21-
1.1.106 Dec 2025Release notes
Open source →- Added
as_slicesandas_mut_slicestoDenseSlotMap. The other methods added in 1.1.0 (keys_as_slice,values_as_sliceandvalues_as_mut_slice) will likely be removed in 2.0.
- Added
-
1.1.006 Dec 2025Release notes
Open source →- Bumped MSRV to 1.58.
- Fixed memory leak in
clone_from. - Added
keys_as_slice,values_as_slice, andvalues_as_mut_slicetoDenseSlotMap. - Ensured that
is_null()keys print asnullin theirDebugrepresentation. - Made
KeyData::newandKeyData::from_fficonst. - Resolved a Miri error in
get_disjoint_mutunder the Stacked Borrows model. - Added
detachandreattachmethods toSlotMapandDenseSlotMapwhich let you temporarily remove key/value pairs from the slot map before adding them back. - Deprecated
HopSlotMap, preparing for removal in 2.0.
-
1.0.730 Nov 2023Release notes
Open source →- Added
clone_fromimplementations for all slot maps. - Added
try_insert_with_keymethods that accept a fallible closure. - Improved performance of insertion and key hashing.
- Made
new_key_typeresistant to shadowing. - Made iterators clonable regardless of item type clonability.
- Added
-
1.0.630 Aug 2021 -
1.0.503 Jul 2021 withdrawnRelease notes
Open source →- Added fuzzing for extra testing.
- Fixed an issue that could cause a segfault when using
HopSlotMap::retainthat had the same underlying cause as the fix in 1.0.4 but was missed.
-
1.0.401 Jul 2021 withdrawnRelease notes
Open source →- Fixed an issue that could cause a segfault when using
HopSlotMap::drain. All versions 0.3+ are affected, and thus yanked.
- Fixed an issue that could cause a segfault when using
-
1.0.309 Apr 2021 withdrawnRelease notes
Open source →- Made
get_disjoint_mutavailable on stable Rust 1.51 and up. - Added unchecked variants for the getters on
SparseSecondaryMap.
- Made
-
1.0.209 Jan 2021 withdrawnRelease notes
Open source →- Fixed the
new_key_type!macro, it assumed theKeytrait was in scope. - Updated code base with more stringent (clippy) warnings, and many small code quality and documentation changes.
- Documented the minimum required stable Rust version, which is 1.49.
- Fixed the
-
1.0.104 Jan 2021 withdrawnRelease notes
Open source →- Fixed an instance where an uninitialized
[u32; N]was created. The uninitialized values were never read - the code always initialized them before reading - but simply having the variable be uninitialized (despite all bit patterns being valid) is technically undefined behavior.
- Fixed an instance where an uninitialized
-
1.0.004 Jan 2021 withdrawnRelease notes
Open source →-
Removed all
Copytrait restrictions of value types stable Rust! There are no longer any restrictions on the types you can store in any of the slot maps. For that reasonSlottablewas deprecated as well. -
no_stdsupport was added, use it by opting out of the default featurestd. -
Added
sm.get_disjoint_mut([k1, k2, ...])which allows you to get mutable references from multiple disjoint keys at the same time. This requiresmin-const-genericsto be stabilized, so until Rust 1.51 comes out this is only available on nightly by setting theunstablefeature. -
Added an
EntryAPI to the secondary maps. -
Added
derive(Clone)for iterators where possible. -
Replaced
Into<KeyData>withKey::data(). -
SecondaryMapnow uses minimal space overhead. Each slot now usesmax(sizeof(T), 4)bytes. -
Moved
SlotMapto thebasicmodule.
-
-
0.4.330 Aug 2021Nothing published for this version
-
0.4.203 Jul 2021 withdrawnNothing published for this version
-
0.4.101 Jul 2021 withdrawn -
0.4.025 Aug 2019 withdrawnRelease notes
Open source →-
Codebase moved to 2018 Edition.
-
Reintroduce
DenseSlotMap- an overzealous removal in 0.3.0. -
Added support for
try_reserve. -
Added support for custom hashers in
SparseSecondaryMap. -
SparseSecondaryMapandSecondaryMapcan now be cloned. -
Keys have a more terse debug output.
-
Fixed a bug that caused an overflowing left shift on 32-bit targets.
-
-
0.3.230 Aug 2021Nothing published for this version
-
0.3.103 Jul 2021 withdrawnNothing published for this version
-
0.3.028 Oct 2018 withdrawnRelease notes
Open source →-
Massive rework, with a focus on secondary maps and custom keys to prevent cross-slotmap key usage.
-
Removed
DenseSlotMapin favour ofHopSlotMapas the latter performs better when secondary maps are in use. -
Unfortunately due to the redesign the first slot in a slot map must now always be empty. This means some deserializations of slot maps serialized with a version before 0.3.0 can fail.
-
Added
SecondaryMapandSparseSecondaryMap, which allows you to associate extra data with keys given by a slot map. -
Added
DefaultKey, custom key types, and support for them on all slot maps and secondary maps. You must now always specify the key type you're using with a slot map, soSlotMap<i32>would beSlotMap<DefaultKey, i32>. It is recommended to make a custom key type withnew_key_type!for any slot map you create, as this entirely prevents using the wrong key on the wrong slot map. -
KeyDatanow hasas_ffiandfrom_ffifunctions that convert the data that makes up a key to/from anu64. This allows you to use slot map keys as opaque handles in FFI code.
-
-
0.2.116 Sep 2018 withdrawnRelease notes
Open source →-
Fixed a potential uninitialized memory vulnerability. No uninitialized memory was read or used directly, but Rust's assumptions could lead to it. Yanked all previous versions as they were all vulnerable.
-
Made a
Keymember non-zero so thatOption<Key>is optimized.
-
-
0.2.017 Jul 2018 withdrawn -
0.1.110 Jul 2018 withdrawnNothing published for this version
-
0.1.002 Jul 2018 withdrawnNothing published for this version