[][src]Struct evmap::MapReadRef

pub struct MapReadRef<'rh, K, V, M, S> where
    K: Hash + Eq,
    S: BuildHasher
{ /* fields omitted */ }

A live reference into the read half of an evmap.

As long as this lives, the map being read cannot change, and if a writer attempts to call [WriteHandle::refresh], 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.

Methods

impl<'rh, K, V, M, S> MapReadRef<'rh, K, V, M, S> where
    K: Hash + Eq,
    S: BuildHasher
[src]

pub fn iter(&self) -> ReadGuardIter<K, V, S>[src]

Iterate over all key + valuesets in the map.

Be careful with this function! While the iteration is ongoing, any writer that tries to refresh 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) -> Option<&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]

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 refreshed by the writer. If no refresh has happened, or the map has been destroyed, this function returns None.

pub fn is_destroyed(&self) -> bool[src]

Returns true if the writer has destroyed this map.

See [WriteHandle::destroy].

pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

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.

Trait Implementations

impl<'rh, K: Debug, V: Debug, M: Debug, S: Debug> Debug for MapReadRef<'rh, K, V, M, S> where
    K: Hash + Eq,
    S: BuildHasher
[src]

impl<'rh, '_, K, Q: ?Sized, V, M, S> Index<&'_ Q> for MapReadRef<'rh, K, V, M, S> where
    K: Eq + Hash + Borrow<Q>,
    Q: Eq + Hash,
    S: BuildHasher
[src]

type Output = Values<V, S>

The returned type after indexing.

impl<'rg, 'rh, K, V, M, S> IntoIterator for &'rg MapReadRef<'rh, K, V, M, S> where
    K: Eq + Hash,
    S: BuildHasher
[src]

type Item = (&'rg K, &'rg Values<V, S>)

The type of the elements being iterated over.

type IntoIter = ReadGuardIter<'rg, K, V, S>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<'rh, K, V, M, S> RefUnwindSafe for MapReadRef<'rh, K, V, M, S> where
    K: RefUnwindSafe,
    M: RefUnwindSafe,
    S: RefUnwindSafe,
    V: RefUnwindSafe

impl<'rh, K, V, M, S> Send for MapReadRef<'rh, K, V, M, S> where
    K: Sync,
    M: Sync,
    S: Sync,
    V: Sync

impl<'rh, K, V, M, S> Sync for MapReadRef<'rh, K, V, M, S> where
    K: Sync,
    M: Sync,
    S: Sync,
    V: Sync

impl<'rh, K, V, M, S> Unpin for MapReadRef<'rh, K, V, M, S>

impl<'rh, K, V, M, S> UnwindSafe for MapReadRef<'rh, K, V, M, S> where
    K: RefUnwindSafe,
    M: RefUnwindSafe,
    S: RefUnwindSafe,
    V: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.