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

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

#1757 in Algorithms

Download history 1577/week @ 2023-11-20 1506/week @ 2023-11-27 1580/week @ 2023-12-04 1703/week @ 2023-12-11 1405/week @ 2023-12-18 838/week @ 2023-12-25 887/week @ 2024-01-01 1577/week @ 2024-01-08 1934/week @ 2024-01-15 1567/week @ 2024-01-22 2282/week @ 2024-01-29 1897/week @ 2024-02-05 2482/week @ 2024-02-12 2564/week @ 2024-02-19 2534/week @ 2024-02-26 2094/week @ 2024-03-04

9,717 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