kovan-map 0.2.2

Lock-free concurrent hash maps using kovan memory reclamation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! What the maps ask of a key or value so that freeing it on another thread is sound.

/// `Send` on every target where threads can share memory, which is every target but wasm32
/// without the `atomics` feature. A replaced or removed entry is freed on whichever thread frees
/// its batch, so there its key and value must be `Send`.
#[cfg(not(all(target_arch = "wasm32", not(target_feature = "atomics"))))]
pub trait MaybeSend: Send {}

#[cfg(not(all(target_arch = "wasm32", not(target_feature = "atomics"))))]
impl<T: Send + ?Sized> MaybeSend for T {}

/// Nothing on wasm32 without the `atomics` feature: the program has one thread, every entry is
/// freed on it, so a map may hold keys and values that are not `Send` (an `Rc`).
#[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))]
pub trait MaybeSend {}

#[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))]
impl<T: ?Sized> MaybeSend for T {}