hawkw / sharded-slab

a lock-free concurrent slab (experimental)
MIT License
273 stars 19 forks source link

Return key immediately on insert duplicate value #90

Open AbstractiveNord opened 1 year ago

AbstractiveNord commented 1 year ago
use sharded_slab::Slab;

fn main() {
    let slab = Slab::new();

    let key = slab.insert("hello world").unwrap();
    println!("Key : {}!", key);
    let key = slab.insert("hello world").unwrap();
    println!("Key : {}!", key);  // value is present, return already present key instead of new insert result
}