Struct dashmap::ReadOnlyView
source · pub struct ReadOnlyView<K, V, S = RandomState> { /* private fields */ }
Expand description
A read-only view into a DashMap
. Allows to obtain raw references to the stored values.
Implementations§
source§impl<K, V, S> ReadOnlyView<K, V, S>
impl<K, V, S> ReadOnlyView<K, V, S>
sourcepub fn into_inner(self) -> DashMap<K, V, S>
pub fn into_inner(self) -> DashMap<K, V, S>
Consumes this ReadOnlyView
, returning the underlying DashMap
.
source§impl<'a, K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone> ReadOnlyView<K, V, S>
impl<'a, K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone> ReadOnlyView<K, V, S>
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the map can hold without reallocating.
sourcepub fn contains_key<Q>(&'a self, key: &Q) -> bool
pub fn contains_key<Q>(&'a self, key: &Q) -> bool
Returns true
if the map contains a value for the specified key.
sourcepub fn get<Q>(&'a self, key: &Q) -> Option<&'a V>
pub fn get<Q>(&'a self, key: &Q) -> Option<&'a V>
Returns a reference to the value corresponding to the key.
sourcepub fn get_key_value<Q>(&'a self, key: &Q) -> Option<(&'a K, &'a V)>
pub fn get_key_value<Q>(&'a self, key: &Q) -> Option<(&'a K, &'a V)>
Returns the key-value pair corresponding to the supplied key.
sourcepub fn iter(&'a self) -> impl Iterator<Item = (&'a K, &'a V)> + 'a
pub fn iter(&'a self) -> impl Iterator<Item = (&'a K, &'a V)> + 'a
An iterator visiting all key-value pairs in arbitrary order. The iterator element type is (&'a K, &'a V)
.
sourcepub fn keys(&'a self) -> impl Iterator<Item = &'a K> + 'a
pub fn keys(&'a self) -> impl Iterator<Item = &'a K> + 'a
An iterator visiting all keys in arbitrary order. The iterator element type is &'a K
.
sourcepub fn values(&'a self) -> impl Iterator<Item = &'a V> + 'a
pub fn values(&'a self) -> impl Iterator<Item = &'a V> + 'a
An iterator visiting all values in arbitrary order. The iterator element type is &'a V
.
sourcepub fn shards(&self) -> &[CachePadded<RwLock<RawTable<(K, SharedValue<V>)>>>]
pub fn shards(&self) -> &[CachePadded<RwLock<RawTable<(K, SharedValue<V>)>>>]
Allows you to peek at the inner shards that store your data. You should probably not use this unless you know what you are doing.
Requires the raw-api
feature to be enabled.
§Examples
use dashmap::DashMap;
let map = DashMap::<(), ()>::new().into_read_only();
println!("Amount of shards: {}", map.shards().len());
Trait Implementations§
source§impl<K: Eq + Hash + Debug, V: Debug, S: BuildHasher + Clone> Debug for ReadOnlyView<K, V, S>
impl<K: Eq + Hash + Debug, V: Debug, S: BuildHasher + Clone> Debug for ReadOnlyView<K, V, S>
source§impl<'a, K, V, S> IntoParallelIterator for &'a ReadOnlyView<K, V, S>
impl<'a, K, V, S> IntoParallelIterator for &'a ReadOnlyView<K, V, S>
source§impl<K, V, S> IntoParallelIterator for ReadOnlyView<K, V, S>
impl<K, V, S> IntoParallelIterator for ReadOnlyView<K, V, S>
Auto Trait Implementations§
impl<K, V, S> Freeze for ReadOnlyView<K, V, S>where
S: Freeze,
impl<K, V, S = RandomState> !RefUnwindSafe for ReadOnlyView<K, V, S>
impl<K, V, S> Send for ReadOnlyView<K, V, S>
impl<K, V, S> Sync for ReadOnlyView<K, V, S>
impl<K, V, S> Unpin for ReadOnlyView<K, V, S>where
S: Unpin,
impl<K, V, S> UnwindSafe for ReadOnlyView<K, V, S>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more