pub struct SyncBtreeMap<K: Eq + Hash, V> { /* private fields */ }
Expand description
this sync map used to many reader,writer less.space-for-time strategy
Implementations§
Source§impl<K, V> SyncBtreeMap<K, V>
impl<K, V> SyncBtreeMap<K, V>
pub fn new_arc() -> Arc<Self>
pub fn new() -> Self
pub fn with_capacity(_capacity: usize) -> Self
pub fn with_map(map: BTreeMap<K, V>) -> Self
pub fn insert(&self, k: K, v: V) -> Option<V>where
K: Ord,
pub fn insert_mut(&mut self, k: K, v: V) -> Option<V>where
K: Ord,
pub fn remove(&self, k: &K) -> Option<V>where
K: Ord,
pub fn remove_mut(&mut self, k: &K) -> Option<V>where
K: Ord,
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn clear(&self)
pub fn clear_mut(&mut self)
pub fn shrink_to_fit(&self)
pub fn shrink_to_fit_mut(&mut self)
pub fn from(map: BTreeMap<K, V>) -> Self
Sourcepub fn get<Q>(&self, k: &Q) -> Option<&V>
pub fn get<Q>(&self, k: &Q) -> Option<&V>
Returns a reference to the value corresponding to the key.
The key may be any borrowed form of the map’s key type, but
Hash
and Eq
on the borrowed form must match those for
the key type.
Since reading a map is unlocked, it is very fast
test bench_sync_hash_map_read … bench: 8 ns/iter (+/- 0)
§Examples
use dark_std::sync::{SyncBtreeMap};
let mut map = SyncBtreeMap::new();
map.insert_mut(1, "a");
assert_eq!(*map.get(&1).unwrap(), "a");
assert_eq!(map.get(&2).is_none(), true);
pub fn get_mut(&self, k: &K) -> Option<BtreeMapRefMut<'_, K, V>>
pub fn contains_key(&self, x: &K) -> bool
pub fn iter(&self) -> MapIter<'_, K, V>
pub fn iter_mut(&self) -> BtreeIterMut<'_, K, V> ⓘ
pub fn into_iter(self) -> MapIntoIter<K, V>
pub fn dirty_ref(&self) -> &BTreeMap<K, V>
pub fn into_inner(self) -> BTreeMap<K, V>
Trait Implementations§
Source§impl<K, V> Debug for SyncBtreeMap<K, V>
impl<K, V> Debug for SyncBtreeMap<K, V>
Source§impl<'de, K, V> Deserialize<'de> for SyncBtreeMap<K, V>
impl<'de, K, V> Deserialize<'de> for SyncBtreeMap<K, V>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<K, V> Display for SyncBtreeMap<K, V>
impl<K, V> Display for SyncBtreeMap<K, V>
Source§impl<K, V> Index<&K> for SyncBtreeMap<K, V>
impl<K, V> Index<&K> for SyncBtreeMap<K, V>
Source§impl<'a, K: Eq + Hash, V> IntoIterator for &'a SyncBtreeMap<K, V>
impl<'a, K: Eq + Hash, V> IntoIterator for &'a SyncBtreeMap<K, V>
Source§impl<K: Eq + Hash, V> IntoIterator for SyncBtreeMap<K, V>
impl<K: Eq + Hash, V> IntoIterator for SyncBtreeMap<K, V>
Source§impl<K, V> Serialize for SyncBtreeMap<K, V>
impl<K, V> Serialize for SyncBtreeMap<K, V>
impl<K: Eq + Hash, V> Send for SyncBtreeMap<K, V>
this is safety, dirty mutex ensure
impl<K: Eq + Hash, V> Sync for SyncBtreeMap<K, V>
this is safety, dirty mutex ensure
Auto Trait Implementations§
impl<K, V> !Freeze for SyncBtreeMap<K, V>
impl<K, V> !RefUnwindSafe for SyncBtreeMap<K, V>
impl<K, V> Unpin for SyncBtreeMap<K, V>
impl<K, V> !UnwindSafe for SyncBtreeMap<K, V>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more