[−][src]Struct evmap::ReadHandle
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()
.
Methods
impl<K, V, M, S> ReadHandle<K, V, M, S> where
K: Eq + Hash,
S: BuildHasher,
[src]
K: Eq + Hash,
S: BuildHasher,
pub fn factory(&self) -> ReadHandleFactory<K, V, M, S>
[src]
Create a new Sync
type that can produce additional ReadHandle
s for use in other
threads.
impl<K, V, M, S> ReadHandle<K, V, M, S> where
K: Eq + Hash,
S: BuildHasher,
M: Clone,
[src]
K: Eq + Hash,
S: BuildHasher,
M: Clone,
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_and<Q: ?Sized, F, T>(&self, key: &Q, then: F) -> Option<T> where
F: FnOnce(&[V]) -> T,
K: Borrow<Q>,
Q: Hash + Eq,
[src]
F: FnOnce(&[V]) -> T,
K: Borrow<Q>,
Q: Hash + Eq,
Applies a function to the values corresponding to the key, and returns the result.
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, this function returns None
.
If no values exist for the given key, no refresh has happened, or the map has been
destroyed, then
will not be called, and None
will be returned.
pub fn meta_get_and<Q: ?Sized, F, T>(
&self,
key: &Q,
then: F
) -> Option<(Option<T>, M)> where
F: FnOnce(&[V]) -> T,
K: Borrow<Q>,
Q: Hash + Eq,
[src]
&self,
key: &Q,
then: F
) -> Option<(Option<T>, M)> where
F: FnOnce(&[V]) -> T,
K: Borrow<Q>,
Q: Hash + Eq,
Applies a function to the values corresponding to the key, and returns the result alongside the meta information.
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 if the map has been closed by the
writer, this function returns None
.
If no values exist for the given key, then
will not be called, and Some(None, _)
is
returned.
pub fn is_destroyed(&self) -> bool
[src]
If the writer has destroyed this map, this method will return true.
See WriteHandle::destroy
.
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 for_each<F>(&self, f: F) where
F: FnMut(&K, &[V]),
[src]
F: FnMut(&K, &[V]),
Read all values in the map, and transform them into a new collection.
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 map_into<Map, Collector, Target>(&self, f: Map) -> Collector where
Map: FnMut(&K, &[V]) -> Target,
Collector: FromIterator<Target>,
[src]
Map: FnMut(&K, &[V]) -> Target,
Collector: FromIterator<Target>,
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]
K: Eq + Hash,
S: BuildHasher,
Auto Trait Implementations
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>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut 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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,