#container #map #data-structure

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

#785 in Data structures

Download history 652/week @ 2021-01-14 576/week @ 2021-01-21 976/week @ 2021-01-28 833/week @ 2021-02-04 537/week @ 2021-02-11 984/week @ 2021-02-18 727/week @ 2021-02-25 414/week @ 2021-03-04 483/week @ 2021-03-11 483/week @ 2021-03-18 774/week @ 2021-03-25 368/week @ 2021-04-01 494/week @ 2021-04-08 591/week @ 2021-04-15 555/week @ 2021-04-22 393/week @ 2021-04-29

2,447 downloads per month
Used in 4 crates (via simulacrum_mock)

MIT license

4KB
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