Struct crossbeam_skiplist::SkipMap[][src]

pub struct SkipMap<K, V> { /* fields omitted */ }

A map based on a lock-free skip list.

Implementations

impl<K, V> SkipMap<K, V>[src]

pub fn new() -> SkipMap<K, V>[src]

Returns a new, empty map.

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

Returns true if the map is empty.

pub fn len(&self) -> usize[src]

Returns the number of entries in the map.

If the map is being concurrently modified, consider the returned number just an approximation without any guarantees.

impl<K, V> SkipMap<K, V> where
    K: Ord
[src]

pub fn front(&self) -> Option<Entry<'_, K, V>>[src]

Returns the entry with the smallest key.

pub fn back(&self) -> Option<Entry<'_, K, V>>[src]

Returns the entry with the largest key.

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

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

pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<Entry<'_, K, V>> where
    K: Borrow<Q>,
    Q: Ord
[src]

Returns an entry with the specified key.

pub fn lower_bound<'a, Q: ?Sized>(
    &'a self,
    bound: Bound<&Q>
) -> Option<Entry<'a, K, V>> where
    K: Borrow<Q>,
    Q: Ord
[src]

Returns an Entry pointing to the lowest element whose key is above the given bound. If no such element is found then None is returned.

pub fn upper_bound<'a, Q: ?Sized>(
    &'a self,
    bound: Bound<&Q>
) -> Option<Entry<'a, K, V>> where
    K: Borrow<Q>,
    Q: Ord
[src]

Returns an Entry pointing to the highest element whose key is below the given bound. If no such element is found then None is returned.

pub fn get_or_insert(&self, key: K, value: V) -> Entry<'_, K, V>[src]

Finds an entry with the specified key, or inserts a new key-value pair if none exist.

pub fn iter(&self) -> Iter<'_, K, V>

Notable traits for Iter<'a, K, V>

impl<'a, K, V> Iterator for Iter<'a, K, V> where
    K: Ord
type Item = Entry<'a, K, V>;
[src]

Returns an iterator over all entries in the map.

pub fn range<Q: ?Sized, R>(&self, range: R) -> Range<'_, Q, R, K, V>

Notable traits for Range<'a, Q, R, K, V>

impl<'a, Q: ?Sized, R, K, V> Iterator for Range<'a, Q, R, K, V> where
    K: Ord + Borrow<Q>,
    R: RangeBounds<Q>,
    Q: Ord
type Item = Entry<'a, K, V>;
where
    K: Borrow<Q>,
    R: RangeBounds<Q>,
    Q: Ord
[src]

Returns an iterator over a subset of entries in the skip list.

impl<K, V> SkipMap<K, V> where
    K: Ord + Send + 'static,
    V: Send + 'static, 
[src]

pub fn insert(&self, key: K, value: V) -> Entry<'_, K, V>[src]

Inserts a key-value pair into the map and returns the new entry.

If there is an existing entry with this key, it will be removed before inserting the new one.

pub fn remove<Q: ?Sized>(&self, key: &Q) -> Option<Entry<'_, K, V>> where
    K: Borrow<Q>,
    Q: Ord
[src]

Removes an entry with the specified key from the map and returns it.

pub fn pop_front(&self) -> Option<Entry<'_, K, V>>[src]

Removes an entry from the front of the map.

pub fn pop_back(&self) -> Option<Entry<'_, K, V>>[src]

Removes an entry from the back of the map.

pub fn clear(&self)[src]

Iterates over the map and removes every entry.

Trait Implementations

impl<K, V> Debug for SkipMap<K, V> where
    K: Ord + Debug,
    V: Debug
[src]

impl<K, V> Default for SkipMap<K, V>[src]

impl<K, V> FromIterator<(K, V)> for SkipMap<K, V> where
    K: Ord
[src]

impl<K, V> IntoIterator for SkipMap<K, V>[src]

type Item = (K, V)

The type of the elements being iterated over.

type IntoIter = IntoIter<K, V>

Which kind of iterator are we turning this into?

impl<'a, K, V> IntoIterator for &'a SkipMap<K, V> where
    K: Ord
[src]

type Item = Entry<'a, K, V>

The type of the elements being iterated over.

type IntoIter = Iter<'a, K, V>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<K, V> !RefUnwindSafe for SkipMap<K, V>

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

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

impl<K, V> Unpin for SkipMap<K, V>

impl<K, V> !UnwindSafe for SkipMap<K, V>

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.