depacked

Crates.iodepacked
lib.rsdepacked
version0.2.3
sourcesrc
created_at2022-04-08 22:16:09.663828
updated_at2022-04-19 18:22:17.66317
descriptionMinimalistic Rust Crate for handling memory packed data to aid CPU caching.
homepage
repositoryhttps://github.com/DigitalExtinction/DePacked
max_upload_size
id564450
size26,147
Martin Indra (Indy2222)

documentation

README

DePacked

crates.io crates.io

Example

use depacked::PackedData;

struct NeedToPack(u32);

fn main() {
    let mut packed = PackedData::with_max_capacity(1000);

    // Insertin is fast but not as CPU cache friendly.
    let first_item = packed.insert(NeedToPack(0));
    let second_item = packed.insert(NeedToPack(1));

    // Getting (mutable) references is fast and CPU cache friendly.
    let first_ref = packed.get(first_item);
    let second_ref_mut = packed.get_mut(second_item);

    // Removing might be slower.
    let first = packed.remove(first_item);
}

License

DePacked is free and open source! All code in this repository is dual-licensed under either:

at your option.

Commit count: 12

cargo fmt