#unique-identifier #container #different #methods #allocating #allocate #id

idalloc

A library for different methods of allocating unique identifiers efficiently

2 releases

0.1.1 Feb 18, 2020
0.1.0 Feb 18, 2020

#1374 in Algorithms

Download history 1255/week @ 2024-09-04 582/week @ 2024-09-11 800/week @ 2024-09-18 810/week @ 2024-09-25 489/week @ 2024-10-02 993/week @ 2024-10-09 1106/week @ 2024-10-16 1074/week @ 2024-10-23 1350/week @ 2024-10-30 1422/week @ 2024-11-06 1553/week @ 2024-11-13 1495/week @ 2024-11-20 1258/week @ 2024-11-27 1465/week @ 2024-12-04 1351/week @ 2024-12-11 1116/week @ 2024-12-18

5,428 downloads per month
Used in yuxii

MIT/Apache

9KB
102 lines

idalloc

Documentation Crates Actions Status

A library for different methods of allocating unique identifiers efficiently.

Provided methods:

  • Slab - Allocates id in a slab-like manner, handling automatic reclamation by keeping a record of which identifier slot to allocate next.

Examples

let mut alloc = idalloc::Slab::<u32>::new();
assert_eq!(0u32, alloc.next());
assert_eq!(1u32, alloc.next());
alloc.free(0u32);

lib.rs:

A library for different methods of allocating unique identifiers efficiently.

Provided methods:

  • [Slab] - Allocates id in a slab-like manner, handling automatic reclamation by keeping a record of which identifier slot to allocate next.

Examples

let mut alloc = idalloc::Slab::<u32>::new();
assert_eq!(0u32, alloc.next());
assert_eq!(1u32, alloc.next());
alloc.free(0u32);

No runtime deps