[−][src]Struct evmap::handles::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
publish
. In other words, all operations performed on a
ReadHandle
will only see writes to the map that preceeded the last call to publish
.
Implementations
impl<K, V, M, S> ReadHandle<K, V, M, S> where
K: Eq + Hash,
V: Eq + Hash,
S: BuildHasher,
M: Clone,
[src]
K: Eq + Hash,
V: Eq + Hash,
S: BuildHasher,
M: Clone,
pub fn enter(&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, changes to the map cannot be published.
If no publish 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]
&'rh self,
key: &Q
) -> Option<ReadGuard<'rh, Values<V, S>>> where
K: Borrow<Q>,
Q: Hash + Eq,
Returns a guarded reference to the values corresponding to the key.
While the guard lives, changes to the map cannot be published.
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<'rh, Q: ?Sized>(&'rh self, key: &Q) -> Option<ReadGuard<'rh, 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.
While the guard lives, changes to the map cannot be published.
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]
&self,
key: &Q
) -> Option<(Option<ReadGuard<'_, Values<V, S>>>, M)> where
K: Borrow<Q>,
Q: Hash + Eq,
Returns a guarded reference to the values corresponding to the key along with the map meta.
While the guard lives, changes to the map cannot be published.
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 was_dropped(&self) -> bool
[src]
Returns true if the WriteHandle
has been dropped.
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,
V: Hash + Eq,
[src]
K: Borrow<Q>,
Aliased<V, NoDrop>: Borrow<W>,
Q: Hash + Eq,
W: Hash + Eq,
V: 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.
pub fn map_into<Map, Collector, Target>(&self, f: Map) -> Collector where
Map: FnMut(&K, &Values<V, S>) -> Target,
Collector: FromIterator<Target>,
[src]
Map: FnMut(&K, &Values<V, S>) -> 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,
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<K, V, M, S> Debug for ReadHandle<K, V, M, S> where
K: Eq + Hash + Debug,
S: BuildHasher,
M: Debug,
[src]
K: Eq + Hash + Debug,
S: BuildHasher,
M: Debug,
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> where
K: Sync,
M: Sync,
S: Sync,
V: Sync,
K: Sync,
M: Sync,
S: Sync,
V: Sync,
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> where
K: RefUnwindSafe,
M: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
M: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,