Struct concurrent_hash_map::ConcurrentHashMap [] [src]

pub struct ConcurrentHashMap<K: Eq + Hash + Sync + Clone, V: Sync + Clone> {
    // some fields omitted
}

This is a simple concurrent hash map. It uses a design that's lock free on gets, and locking on inserts/removals. In order to maintain concurrency on insert/removal operations, the map is segmented into several sub-maps, each of which has its own write lock.

This code is currently extremely pre-alpha. Most particularly, it leaks memory on table growth and drop, as well as when using keys or values that (even transitively) use custom Drop implementations. It should be possible to fix this, but a clean solution will require support for running destructors in crossbeam (see crossbeam issue #13).

For now it may be useful for long lived hashmaps with a relatively steady size, but I don't recommend using it for anything important :-).

Methods

impl<K: Eq + Hash + Sync + Clone, V: Sync + Clone> ConcurrentHashMap<K, V>
[src]

fn new() -> ConcurrentHashMap<K, V>

fn new_with_options(capacity: u32, segments: u32, load_factor: f32) -> ConcurrentHashMap<K, V>

fn insert(&mut self, key: K, value: V) -> Option<V>

fn get(&self, key: K) -> Option<V>

fn remove(&mut self, key: K) -> Option<V>

fn size(&self) -> u32

Trait Implementations

impl<K: Eq + Hash + Sync + Clone, V: Sync + Clone> Clone for ConcurrentHashMap<K, V>
[src]

fn clone(&self) -> ConcurrentHashMap<K, V>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more