stdlib/slabView source ↗
slab
8 items · generated by scribe fromstdlib/slab.fd· synced 2026-11-15
stdlib/slab8 items
Contents
- Slab (struct)
- slab_new (function)
- slab_alloc (function)
- slab_free (function)
- slab_off (function)
- slab_clear (function)
Slab
pub struct Slab {Fields:
| Name | Type |
|---|---|
obj_size | i64 |
capacity | i64 |
used | i64 |
free_head | i64 |
backing | Vec<i64> |
Defined at line 8
slab_new
Slab of capacity objects of obj_size bytes (>= 4, so the free link fits). Free list threads index+1 through each slot (0 = end).
pub fn slab_new(obj_size: i64, capacity: i64) -> Slab {Parameters:
obj_size:i64capacity:i64
Returns: Slab
Defined at line 30
slab_alloc
Allocate an object: returns its index (byte offset / obj_size), or -1 when the slab is exhausted.
pub fn slab_alloc(s: & mut Slab) -> i64 {Parameters:
s:& mut Slab
Returns: i64
Defined at line 63
slab_free
Return object i to the free list.
pub fn slab_free(s: & mut Slab, i: i64) {Parameters:
s:& mut Slabi:i64
Defined at line 79
slab_off
Byte offset of object i inside the backing store.
pub fn slab_off(s: & Slab, i: i64) -> i64 {Parameters:
s:& Slabi:i64
Returns: i64
Defined at line 90
slab_clear
Fill object i’s bytes with a value (0 to clear).
pub fn slab_clear(s: & mut Slab, i: i64, v: i64) {Parameters:
s:& mut Slabi:i64v:i64
Defined at line 95
Generated by scribe, the Fides documentation generator