| Crates.io | generic_slab |
| lib.rs | generic_slab |
| version | 0.1.1 |
| created_at | 2024-03-08 11:25:04.463999+00 |
| updated_at | 2024-03-08 11:48:40.611039+00 |
| description | Pre-allocated storage for a uniform data type |
| homepage | |
| repository | https://github.com/Bergmann89/generic_slab |
| max_upload_size | |
| id | 1166750 |
| size | 121,840 |
generic_slab is a fork of slab that provides more control over the key and storage types. Using a generic approach you can for example implement strong typed keys that must fit the data type stored in the slab, or you can use a fixed size array as backing storage for the slab data.
To use generic_slab, first add this to your Cargo.toml:
[dependencies]
generic_slab = "0.1"
Next, add this to your crate:
use generic_slab::Slab;
let mut slab = Slab::new();
let hello = slab.insert("hello");
let world = slab.insert("world");
assert_eq!(slab[hello], "hello");
assert_eq!(slab[world], "world");
slab[world] = "earth";
assert_eq!(slab[world], "earth");
See documentation for more details.
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in generic_slab by you, shall be licensed as MIT, without any additional
terms or conditions.