#map #container #data-structure #reuse

handlebox

A map-like collection that reuses unused keys

2 unstable releases

Uses old Rust 2015

0.3.0 Dec 16, 2017
0.2.0 Dec 16, 2017

#2179 in Data structures

Download history 2519/week @ 2023-11-24 2062/week @ 2023-12-01 2655/week @ 2023-12-08 1647/week @ 2023-12-15 669/week @ 2023-12-22 975/week @ 2023-12-29 750/week @ 2024-01-05 348/week @ 2024-01-12 216/week @ 2024-01-19 127/week @ 2024-01-26 123/week @ 2024-02-02 145/week @ 2024-02-09 615/week @ 2024-02-16 48/week @ 2024-02-23 34/week @ 2024-03-01 17/week @ 2024-03-08

729 downloads per month
Used in 4 crates (via simulacrum_mock)

MIT license

5KB
70 lines

Handlebox

Handlebox is a simple map-like collection that reuses unused keys. Right now it's hard-coded to use u32 keys.

To install, add this line to your Cargo.toml:

[dependencies]
handlebox = "0.3.0"

Note that Handlebox has not yet reached version 1.0, so the API may change drastically between releases.

Example

use handlebox::*;

// Creating
let mut c = HandleBox::new();

// Adding values
let h1 = c.add(888);

// Accessing values
assert_eq!(c.get(&h1).unwrap(), &888);

// Removing values
c.remove(&h1);

// You can access the internal BTreeMap<u32, V> with the .map field
assert_eq!(c.map.values().len(), 0);

No runtime deps