[−][src]Struct evmap::refs::MapReadRef
A live reference into the read half of an evmap.
As long as this lives, changes to the map being read cannot be published. If a writer attempts
to call WriteHandle::publish
, that call will block until this is dropped.
Since the map remains immutable while this lives, the methods on this type all give you unguarded references to types contained in the map.
Implementations
impl<'rh, K, V, M, S> MapReadRef<'rh, K, V, M, S> where
K: Hash + Eq,
V: Eq + Hash,
S: BuildHasher,
[src]
K: Hash + Eq,
V: Eq + Hash,
S: BuildHasher,
pub fn iter(&self) -> ReadGuardIter<'_, K, V, S>ⓘNotable traits for ReadGuardIter<'rg, K, V, S>
impl<'rg, K, V, S> Iterator for ReadGuardIter<'rg, K, V, S> where
K: Eq + Hash,
V: Eq + Hash,
S: BuildHasher, type Item = (&'rg K, &'rg Values<V, S>);
[src]
Notable traits for ReadGuardIter<'rg, K, V, S>
impl<'rg, K, V, S> Iterator for ReadGuardIter<'rg, K, V, S> where
K: Eq + Hash,
V: Eq + Hash,
S: BuildHasher, type Item = (&'rg K, &'rg Values<V, S>);
Iterate over all key + valuesets in the map.
Be careful with this function! While the iteration is ongoing, any writer that tries to publish changes will block waiting on this reader to finish.
pub fn keys(&self) -> KeysIter<'_, K, V, S>
[src]
Iterate over all keys in the map.
Be careful with this function! While the iteration is ongoing, any writer that tries to publish changes will block waiting on this reader to finish.
pub fn values(&self) -> ValuesIter<'_, K, V, S>
[src]
Iterate over all value sets in the map.
Be careful with this function! While the iteration is ongoing, any writer that tries to publish changes will block waiting on this reader to finish.
pub fn len(&self) -> usize
[src]
Returns the number of non-empty keys present in the map.
pub fn is_empty(&self) -> bool
[src]
Returns true if the map contains no elements.
pub fn meta(&self) -> &M
[src]
Get the current meta value.
pub fn get<'a, Q: ?Sized>(&'a self, key: &Q) -> Option<&'a Values<V, S>> where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
Returns a reference to the values 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.
Note that not all writes will be included with this read -- only those that have been
published by the writer. If no publish has happened, or the map has been destroyed, this
function returns None
.
pub fn get_one<'a, Q: ?Sized>(&'a self, key: &Q) -> Option<&'a V> where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
Returns a guarded reference to one value corresponding to the key.
This is mostly intended for use when you are working with no more than one value per key. If there are multiple values stored for this key, there are no guarantees to which element is returned.
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.
Note that not all writes will be included with this read -- only those that have been
published by the writer. If no publish has happened, or the map has been destroyed, this
function returns None
.
pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
Returns true if the map contains any values for the specified 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.
pub fn contains_value<Q: ?Sized, W: ?Sized>(&self, key: &Q, value: &W) -> bool where
K: Borrow<Q>,
Aliased<V, NoDrop>: Borrow<W>,
Q: Hash + Eq,
W: Hash + Eq,
[src]
K: Borrow<Q>,
Aliased<V, NoDrop>: Borrow<W>,
Q: Hash + Eq,
W: Hash + Eq,
Returns true if the map contains the specified value for the specified key.
The key and value may be any borrowed form of the map's respective types, but Hash
and
Eq
on the borrowed form must match.
Trait Implementations
impl<'rh, K, V, M, S> Debug for MapReadRef<'rh, K, V, M, S> where
K: Hash + Eq,
V: Eq + Hash,
S: BuildHasher,
K: Debug,
M: Debug,
V: Debug,
[src]
K: Hash + Eq,
V: Eq + Hash,
S: BuildHasher,
K: Debug,
M: Debug,
V: Debug,
impl<'rh, K, Q: ?Sized, V, M, S, '_> Index<&'_ Q> for MapReadRef<'rh, K, V, M, S> where
K: Eq + Hash + Borrow<Q>,
V: Eq + Hash,
Q: Eq + Hash,
S: BuildHasher,
[src]
K: Eq + Hash + Borrow<Q>,
V: Eq + Hash,
Q: Eq + Hash,
S: BuildHasher,
type Output = Values<V, S>
The returned type after indexing.
pub fn index(&self, key: &Q) -> &Self::Output
[src]
impl<'rg, 'rh, K, V, M, S> IntoIterator for &'rg MapReadRef<'rh, K, V, M, S> where
K: Eq + Hash,
V: Eq + Hash,
S: BuildHasher,
[src]
K: Eq + Hash,
V: Eq + Hash,
S: BuildHasher,
Auto Trait Implementations
impl<'rh, K, V, M = (), S = RandomState> !RefUnwindSafe for MapReadRef<'rh, K, V, M, S>
[src]
impl<'rh, K, V, M = (), S = RandomState> !Send for MapReadRef<'rh, K, V, M, S>
[src]
impl<'rh, K, V, M = (), S = RandomState> !Sync for MapReadRef<'rh, K, V, M, S>
[src]
impl<'rh, K, V, M, S> Unpin for MapReadRef<'rh, K, V, M, S>
[src]
impl<'rh, K, V, M = (), S = RandomState> !UnwindSafe for MapReadRef<'rh, K, V, M, S>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,