sharded-slab icon indicating copy to clipboard operation
sharded-slab copied to clipboard

Return key immediately on insert duplicate value

Open AbstractiveNord opened this issue 1 year ago • 0 comments

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
}

AbstractiveNord avatar Oct 14 '23 11:10 AbstractiveNord