Struct network::application::storage::LockingHashMap
source · [−]pub struct LockingHashMap<Key: Clone + Debug + Eq + Hash, Value: Clone + Debug> { /* private fields */ }Expand description
A generic locking hash map with ability to read before write consistency
Implementations
sourceimpl<Key, Value> LockingHashMap<Key, Value> where
Key: Clone + Debug + Eq + Hash,
Value: Clone + Debug,
impl<Key, Value> LockingHashMap<Key, Value> where
Key: Clone + Debug + Eq + Hash,
Value: Clone + Debug,
pub fn new() -> Self
sourcepub fn read_filtered<F: FnMut(&(&Key, &Value)) -> bool>(
&self,
filter: F
) -> HashMap<Key, Value>
pub fn read_filtered<F: FnMut(&(&Key, &Value)) -> bool>(
&self,
filter: F
) -> HashMap<Key, Value>
Filtered read clone based on keys or values
sourcepub fn keys(&self) -> Vec<Key>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn keys(&self) -> Vec<Key>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
All keys of the hash map
sourcepub fn write<F: FnOnce(&mut Entry<'_, Key, Value>) -> Result<(), PeerError>>(
&self,
key: Key,
modifier: F
) -> Result<(), PeerError>
pub fn write<F: FnOnce(&mut Entry<'_, Key, Value>) -> Result<(), PeerError>>(
&self,
key: Key,
modifier: F
) -> Result<(), PeerError>
Take in a function to modify the data, must handle concurrency control with the input function
sourcepub fn write_lock(&self) -> RwLockWriteGuard<'_, HashMap<Key, Value>>
pub fn write_lock(&self) -> RwLockWriteGuard<'_, HashMap<Key, Value>>
Get the underlying RwLock of the map. Usage is discouraged as it leads to the possiblity of
leaving the lock held for a long period of time. However, not everything fits into the write
model.
Trait Implementations
Auto Trait Implementations
impl<Key, Value> RefUnwindSafe for LockingHashMap<Key, Value>
impl<Key, Value> Send for LockingHashMap<Key, Value> where
Key: Send,
Value: Send,
impl<Key, Value> Sync for LockingHashMap<Key, Value> where
Key: Send + Sync,
Value: Send + Sync,
impl<Key, Value> Unpin for LockingHashMap<Key, Value> where
Key: Unpin,
Value: Unpin,
impl<Key, Value> UnwindSafe for LockingHashMap<Key, Value>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more