pub struct ReactiveMapCore<K, V> {
pub subscribers_any: Arc<Mutex<Vec<(u64, SubscriberAny<K, V>, SubscriptionMeta)>>>,
pub subscribers_key: Arc<DashMap<K, Vec<(u64, SubscriberKey<K, V>, SubscriptionMeta)>>>,
pub next_id: Arc<AtomicU64>,
pub cache: Arc<MapCache<K, V>>,
}Fields§
§subscribers_any: Arc<Mutex<Vec<(u64, SubscriberAny<K, V>, SubscriptionMeta)>>>§subscribers_key: Arc<DashMap<K, Vec<(u64, SubscriberKey<K, V>, SubscriptionMeta)>>>§next_id: Arc<AtomicU64>§cache: Arc<MapCache<K, V>>Implementations§
Source§impl<K: ReactiveMapKey, V: ReactiveMapValue> ReactiveMapCore<K, V>
impl<K: ReactiveMapKey, V: ReactiveMapValue> ReactiveMapCore<K, V>
pub fn new() -> Self
Sourcepub fn with_capacity(_entries: usize) -> Self
pub fn with_capacity(_entries: usize) -> Self
The same. A tree has nothing to reserve, so entries is ignored; the
signature stays because a caller loading a store knows the size and
should not have to know that.
pub fn subscribe_any<F>(&self, callback: F) -> SignalSubscription
pub fn subscribe_key<F>(&self, key: K, callback: F) -> SignalSubscription
Sourcepub fn notify(&self, change: &MapChange<K, V>)
pub fn notify(&self, change: &MapChange<K, V>)
Fires every subscriber interested in change.
The callbacks are collected before any of them runs, and every guard is
released first. A subscriber reacting to a change by writing to the same
map is ordinary, and neither a Mutex nor a DashMap shard is
reentrant, so holding either across the calls deadlocks the thread.
Trait Implementations§
Source§impl<K, V> Clone for ReactiveMapCore<K, V>
impl<K, V> Clone for ReactiveMapCore<K, V>
Source§impl<K: ReactiveMapKey, V: ReactiveMapValue> Default for ReactiveMapCore<K, V>
impl<K: ReactiveMapKey, V: ReactiveMapValue> Default for ReactiveMapCore<K, V>
Auto Trait Implementations§
impl<K, V> !RefUnwindSafe for ReactiveMapCore<K, V>
impl<K, V> !UnwindSafe for ReactiveMapCore<K, V>
impl<K, V> Freeze for ReactiveMapCore<K, V>
impl<K, V> Send for ReactiveMapCore<K, V>
impl<K, V> Sync for ReactiveMapCore<K, V>
impl<K, V> Unpin for ReactiveMapCore<K, V>
impl<K, V> UnsafeUnpin for ReactiveMapCore<K, V>where
Arc<Mutex<Vec<(u64, Arc<dyn Fn(&MapChange<K, V>) + Sync + Send>, SubscriptionMeta)>>>: UnsafeUnpin,
Arc<DashMap<K, Vec<(u64, Arc<dyn Fn(&MapChange<K, V>) + Sync + Send>, SubscriptionMeta)>>>: UnsafeUnpin,
Arc<MapCache<K, V>>: UnsafeUnpin,
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