[][src]Struct evmap::ReadHandle

pub struct ReadHandle<K, V, M = (), S = RandomState> where
    K: Eq + Hash,
    S: BuildHasher
{ /* fields omitted */ }

A handle that may be used to read from the eventually consistent map.

Note that any changes made to the map will not be made visible until the writer calls refresh(). In other words, all operations performed on a ReadHandle will only see writes to the map that preceeded the last call to refresh().

Implementations

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

pub fn factory(&self) -> ReadHandleFactory<K, V, M, S>[src]

Create a new Sync type that can produce additional ReadHandles for use in other threads.

impl<K, V, M, S> ReadHandle<K, V, M, S> where
    K: Eq + Hash,
    V: Eq + Hash,
    S: BuildHasher,
    M: Clone
[src]

pub fn read(&self) -> Option<MapReadRef<K, V, M, S>>[src]

Take out a guarded live reference to the read side of the map.

This lets you perform more complex read operations on the map.

While the reference lives, the map cannot be refreshed.

If no refresh has happened, or the map has been destroyed, this function returns None.

See MapReadRef.

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<ReadGuard<M>>[src]

Get the current meta value.

pub fn get<'rh, Q: ?Sized>(
    &'rh self,
    key: &Q
) -> Option<ReadGuard<'rh, Values<V, S>>> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

Returns a guarded reference to the values corresponding to the key.

While the guard lives, the map cannot be refreshed.

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 get_one<'rh, Q: ?Sized>(&'rh self, key: &Q) -> Option<ReadGuard<'rh, V>> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

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.

While the guard lives, the map cannot be refreshed.

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 meta_get<Q: ?Sized>(
    &self,
    key: &Q
) -> Option<(Option<ReadGuard<Values<V, S>>>, M)> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

Returns a guarded reference to the values corresponding to the key along with the map meta.

While the guard lives, the map cannot be refreshed.

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.

If no values exist for the given key, Some(None, _) is returned.

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.

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

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.

pub fn map_into<Map, Collector, Target>(&self, f: Map) -> Collector where
    Map: FnMut(&K, &Values<V, S>) -> Target,
    Collector: FromIterator<Target>, 
[src]

Read all values in the map, and transform them into a new collection.

Trait Implementations

impl<K, V, M, S> Clone for ReadHandle<K, V, M, S> where
    K: Eq + Hash,
    S: BuildHasher
[src]

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

impl<K, V, M, S> Drop for ReadHandle<K, V, M, S> where
    K: Eq + Hash,
    S: BuildHasher
[src]

Auto Trait Implementations

impl<K, V, M = (), S = RandomState> !RefUnwindSafe for ReadHandle<K, V, M, S>

impl<K, V, M, S> Send for ReadHandle<K, V, M, S>

impl<K, V, M = (), S = RandomState> !Sync for ReadHandle<K, V, M, S>

impl<K, V, M, S> Unpin for ReadHandle<K, V, M, S>

impl<K, V, M, S> UnwindSafe for ReadHandle<K, V, M, S>

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.