#identifier

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

#1365 in Algorithms

Download history 779/week @ 2024-07-27 1121/week @ 2024-08-03 1231/week @ 2024-08-10 1605/week @ 2024-08-17 1282/week @ 2024-08-24 1190/week @ 2024-08-31 1052/week @ 2024-09-07 391/week @ 2024-09-14 1040/week @ 2024-09-21 468/week @ 2024-09-28 698/week @ 2024-10-05 1210/week @ 2024-10-12 1012/week @ 2024-10-19 1240/week @ 2024-10-26 1442/week @ 2024-11-02 1182/week @ 2024-11-09

5,146 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