Skip to content

arseniybelkov/jloc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jloc

⚠️ Work in Progress Allocator agnostic joint allocations for Rust

Usage

Slices preallocated memory pool into contiguous blocks of different types.

// Here xs, ys and zs are using memory allocated in `pool`.
struct Something {
    pool: JointPool,
    xs: JointSlice<u32>,
    ys: JointSlice<Filler>,
    zs: JointSlice<Enum>,
}

impl Something {
    fn new() -> Self {
        // name: type = number of elements to allocate
        let p = allocate_joint! {
            xs: u32 = 3, ys: Filler = 2, zs: Enum = 1
        };
        Self {
            pool: p.pool,
            xs: p.xs,
            ys: p.ys,
            zs: p.zs,
        }
    }
}

About

Allocator agnostic joint allocations for Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages