Crates.io | slabbable-impl-selector |
lib.rs | slabbable-impl-selector |
version | |
source | src |
created_at | 2025-01-24 01:53:37.088807+00 |
updated_at | 2025-01-24 01:53:37.088807+00 |
description | Slabbable data structure impl selector |
homepage | https://github.com/yaws-rs/edifice |
repository | https://github.com/yaws-rs/edifice |
max_upload_size | |
id | 1528926 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Proxy for conveniently pulling and selecting Slabbable impl.
In your crate that pulls slabbable-impl-selector as dependency:
env RUSTFLAGS='--cfg slabbable_impl="impl"' cargo ..
Cargo.toml
slabbable = { version = "0.1" }
slabbable-impl-selector = { version = "0.1" }
Code level:
use slabbable::{Slabbable, SlabbableError};
use ::slabbable_impl_selector::SelectedSlab;
#[derive(Clone, Debug)]
struct Holder {
my_stuff: SelectedSlab<usize>,
}
let mut slab = SelectedSlab::<usize>::with_fixed_capacity(1);
slab.take_next_with(1).expect("Could not take the first one");
assert!(slab.take_next_with(2), Err(SlabbableError::AtCapacity(1)));
value | rotating usize? | description |
---|---|---|
stablevec | no | StableVec |
slab | no | Slab |
hash [ yes | Hash |
Default impl is hash.
The choice of the implementation selection is solely by the top-level binary otherwise.
Rotating usize allows avoiding immedia re-use of key index until whole usize has spinned over.
Without rotating, the re-use will pick-up slots that may have been recently free'd.