[][src]Struct ev_slotmap::WriteHandle

pub struct WriteHandle<K, P, V> where
    K: Key<P>,
    V: ShallowCopy
{ /* fields omitted */ }

A handle that may be used to modify the concurrent map.

When the WriteHandle is dropped, the map is immediately (but safely) taken away from all readers, causing all future lookups to return None.

Implementations

impl<K, P, V> WriteHandle<K, P, V> where
    K: Key<P>,
    V: ShallowCopy
[src]

pub fn insert(&mut self, p: P, v: V) -> K[src]

Insert the given value into the slot map and return the associated key

pub fn update(&mut self, k: K, v: V)[src]

Replace the value of the given key with the given value.

pub fn clear(&mut self)[src]

Clear the slot map.

pub fn remove(&mut self, k: &K)[src]

Remove the value from the map for the given key

pub fn values(&mut self) -> impl Iterator<Item = &V>[src]

Get an iterator over all the items in the slot map directly without using an intermediate object. This is safe only because we are taking exclusive access to the writer to ensure no writes can occur while we are reading

pub fn iter<F>(&mut self, pointer_finder: F) -> impl Iterator<Item = (K, &V)> where
    F: FnMut(&V) -> P, 
[src]

Get an iterator over all the keys and values in the slot map as long as you have a way to create the pointer value from the stored value. This is done directly without needing an intermediate object, and is safe only because we are taking exclusive access to the writer to ensure no writes can occur while we are reading

pub fn iter_raw(&mut self) -> impl Iterator<Item = (SlotMapKeyData, &V)>[src]

Get an iterator over all the raw key data and values in the map directly without using an intermediate object. This is safe only because we are taking exclusive access to the writer to ensure no writes can occur while we are reading

Methods from Deref<Target = ReadHandle<K, P, V>>

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

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

pub fn read(&self) -> Option<MapReadRef<'_, K, P, V>>[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 non-empty keys.

pub fn get<'rh>(&'rh self, key: &K) -> Option<ReadGuard<'rh, V>>[src]

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

While the guard lives, the map cannot be refreshed.

If no writes have happened or if the write handle has been dropped, then None is returned here

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

Returns true if the writer has destroyed this map (This happens when the writer is dropped).

pub fn contains_key(&self, key: &K) -> bool[src]

Returns true if the map contains a value for the specified key.

Trait Implementations

impl<K, P, V> Debug for WriteHandle<K, P, V> where
    K: Key<P> + Debug,
    V: Debug + ShallowCopy
[src]

impl<K, P, V> Deref for WriteHandle<K, P, V> where
    K: Key<P>,
    V: ShallowCopy
[src]

type Target = ReadHandle<K, P, V>

The resulting type after dereferencing.

impl<K, P, V> Drop for WriteHandle<K, P, V> where
    K: Key<P>,
    V: ShallowCopy
[src]

Auto Trait Implementations

impl<K, P, V> !RefUnwindSafe for WriteHandle<K, P, V>

impl<K, P, V> Send for WriteHandle<K, P, V> where
    K: Send,
    P: Send,
    V: Send + Sync

impl<K, P, V> !Sync for WriteHandle<K, P, V>

impl<K, P, V> Unpin for WriteHandle<K, P, V> where
    K: Unpin,
    P: Unpin,
    V: Unpin

impl<K, P, V> UnwindSafe for WriteHandle<K, P, V> where
    K: UnwindSafe,
    P: UnwindSafe,
    V: UnwindSafe

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.