sparse-slot 0.0.3

minimal sparse slot (sparse vector)
Documentation
  • Coverage
  • 5.26%
    2 out of 38 items documented1 out of 32 items with examples
  • Size
  • Source code size: 21.99 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 5.79 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • piot/sparse-slot
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • piot

🎰 sparse-slot

A lightning-fast, memory-efficient sparse slot map implementation in Rust.

✨ Features

  • 🚀 Fixed-size Power: Pre-allocated capacity for predictable performance
  • 🎯 Safe Access: Generation-based handles prevent the "dangling pointer blues"
  • 🔄 Reusable Slots: Removed items' slots can be reused, like a game of musical chairs
  • 🎭 Double Life: Values can be accessed both immutably and mutably

📦 Installation

Add this to your Cargo.toml:

[dependencies]
sparse-slot = "0.0.3"

🛠️ Usage

Here's a quick example to get you started:

use sparse_slot::SparseSlot;

fn main() {
    let mut slot = SparseSlot::new(5);
    let id = slot.try_set("Hello, world!").expect("failed to set");
    println!("Stored value: {:?}", slot.get(id));
}

About Contributions

This project is open source with a single copyright holder (that's me!). While the code is publicly available under the MIT License, I'm not accepting external contributions at this time.

If you have suggestions or stumble upon bugs, please open an issue for discussion. While I can't accept pull requests, your feedback is invaluable and helps make the project better.

Thank you for your understanding and interest in this project! Your engagement means the world to me. 🙏

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright (c) 2024 Peter Bjorklund. All rights reserved.