6 releases (3 breaking)
0.4.0 | Mar 25, 2022 |
---|---|
0.3.1 | May 21, 2020 |
0.2.0 | May 5, 2020 |
0.1.1 | Apr 25, 2020 |
#1385 in Data structures
24 downloads per month
27KB
265 lines
Slots
This crate provides a heapless slab allocator with strict access control.
Slots implements a static friendly, fixed size, unordered data structure inspired by SlotMap. All operations are constant time.
Features
-
Slots provide the
runtime_checks
feature that can be used to disable key owner verification. By default the feature is on and it is recommended to leave it enabled for development builds and disabled for release builds.Note: This feature requires atomic instructions, which are not generally available (for example, on ARM Cortex-M0 microcontrollers)
lib.rs
:
This crate provides a heapless, fixed size, unordered data structure, inspired by SlotMap.
The following basic operations (all of them O(1)
) are defined for Slots:
- Store: store data and retrieve a handle for later access
- Read, modify: use the given handle to access the data without removal
- Take: use the given handle to remove data
There are two variations of this data structure:
Slots
, where elements can only be modified using aKey
that can't be copiedUnrestrictedSlots
, where elements are free to be modified by anyone
Dependencies
~22KB