Struct crossbeam_skiplist_piedb::SkipList
source · [−]pub struct SkipList<K, V> { /* private fields */ }
Expand description
A lock-free skip list.
Implementations
sourceimpl<K, V> SkipList<K, V> where
K: Ord,
impl<K, V> SkipList<K, V> where
K: Ord,
sourcepub fn front<'a: 'g, 'g>(
&'a self,
guard: &'g Guard
) -> Option<Entry<'a, 'g, K, V>>
pub fn front<'a: 'g, 'g>(
&'a self,
guard: &'g Guard
) -> Option<Entry<'a, 'g, K, V>>
Returns the entry with the smallest key.
sourcepub fn back<'a: 'g, 'g>(
&'a self,
guard: &'g Guard
) -> Option<Entry<'a, 'g, K, V>>
pub fn back<'a: 'g, 'g>(
&'a self,
guard: &'g Guard
) -> Option<Entry<'a, 'g, K, V>>
Returns the entry with the largest key.
sourcepub fn contains_key<Q>(&self, key: &Q, guard: &Guard) -> bool where
K: Borrow<Q>,
Q: Ord + ?Sized,
pub fn contains_key<Q>(&self, key: &Q, guard: &Guard) -> bool where
K: Borrow<Q>,
Q: Ord + ?Sized,
Returns true
if the map contains a value for the specified key.
sourcepub fn get<'a: 'g, 'g, Q>(
&'a self,
key: &Q,
guard: &'g Guard
) -> Option<Entry<'a, 'g, K, V>> where
K: Borrow<Q>,
Q: Ord + ?Sized,
pub fn get<'a: 'g, 'g, Q>(
&'a self,
key: &Q,
guard: &'g Guard
) -> Option<Entry<'a, 'g, K, V>> where
K: Borrow<Q>,
Q: Ord + ?Sized,
Returns an entry with the specified key
.
sourcepub fn lower_bound<'a: 'g, 'g, Q>(
&'a self,
bound: Bound<&Q>,
guard: &'g Guard
) -> Option<Entry<'a, 'g, K, V>> where
K: Borrow<Q>,
Q: Ord + ?Sized,
pub fn lower_bound<'a: 'g, 'g, Q>(
&'a self,
bound: Bound<&Q>,
guard: &'g Guard
) -> Option<Entry<'a, 'g, K, V>> where
K: Borrow<Q>,
Q: Ord + ?Sized,
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.
sourcepub fn upper_bound<'a: 'g, 'g, Q>(
&'a self,
bound: Bound<&Q>,
guard: &'g Guard
) -> Option<Entry<'a, 'g, K, V>> where
K: Borrow<Q>,
Q: Ord + ?Sized,
pub fn upper_bound<'a: 'g, 'g, Q>(
&'a self,
bound: Bound<&Q>,
guard: &'g Guard
) -> Option<Entry<'a, 'g, K, V>> where
K: Borrow<Q>,
Q: Ord + ?Sized,
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.
sourcepub fn get_or_insert(
&self,
key: K,
value: V,
guard: &Guard
) -> RefEntry<'_, K, V>
pub fn get_or_insert(
&self,
key: K,
value: V,
guard: &Guard
) -> RefEntry<'_, K, V>
Finds an entry with the specified key, or inserts a new key
-value
pair if none exist.
sourcepub fn get_or_insert_with<F>(
&self,
key: K,
value: F,
guard: &Guard
) -> RefEntry<'_, K, V> where
F: FnOnce() -> V,
pub fn get_or_insert_with<F>(
&self,
key: K,
value: F,
guard: &Guard
) -> RefEntry<'_, K, V> where
F: FnOnce() -> V,
Finds an entry with the specified key, or inserts a new key
-value
pair if none exist,
where value is calculated with a function.
Note: Another thread may write key value first, leading to the result of this closure discarded. If closure is modifying some other state (such as shared counters or shared objects), it may lead to undesired behaviour such as counters being changed without result of closure inserted
sourcepub fn iter<'a: 'g, 'g>(&'a self, guard: &'g Guard) -> Iter<'a, 'g, K, V>ⓘNotable traits for Iter<'a, 'g, K, V>impl<'a: 'g, 'g, K: 'a, V: 'a> Iterator for Iter<'a, 'g, K, V> where
K: Ord, type Item = Entry<'a, 'g, K, V>;
pub fn iter<'a: 'g, 'g>(&'a self, guard: &'g Guard) -> Iter<'a, 'g, K, V>ⓘNotable traits for Iter<'a, 'g, K, V>impl<'a: 'g, 'g, K: 'a, V: 'a> Iterator for Iter<'a, 'g, K, V> where
K: Ord, type Item = Entry<'a, 'g, K, V>;
K: Ord, type Item = Entry<'a, 'g, K, V>;
Returns an iterator over all entries in the skip list.
sourcepub fn ref_iter(&self) -> RefIter<'_, K, V>
pub fn ref_iter(&self) -> RefIter<'_, K, V>
Returns an iterator over all entries in the skip list.
sourcepub fn range<'a: 'g, 'g, Q, R>(
&'a self,
range: R,
guard: &'g Guard
) -> Range<'a, 'g, Q, R, K, V>ⓘNotable traits for Range<'a, 'g, Q, R, K, V>impl<'a: 'g, 'g, Q, R, K: 'a, V: 'a> Iterator for Range<'a, 'g, Q, R, K, V> where
K: Ord + Borrow<Q>,
R: RangeBounds<Q>,
Q: Ord + ?Sized, type Item = Entry<'a, 'g, K, V>;
where
K: Borrow<Q>,
R: RangeBounds<Q>,
Q: Ord + ?Sized,
pub fn range<'a: 'g, 'g, Q, R>(
&'a self,
range: R,
guard: &'g Guard
) -> Range<'a, 'g, Q, R, K, V>ⓘNotable traits for Range<'a, 'g, Q, R, K, V>impl<'a: 'g, 'g, Q, R, K: 'a, V: 'a> Iterator for Range<'a, 'g, Q, R, K, V> where
K: Ord + Borrow<Q>,
R: RangeBounds<Q>,
Q: Ord + ?Sized, type Item = Entry<'a, 'g, K, V>;
where
K: Borrow<Q>,
R: RangeBounds<Q>,
Q: Ord + ?Sized,
K: Ord + Borrow<Q>,
R: RangeBounds<Q>,
Q: Ord + ?Sized, type Item = Entry<'a, 'g, K, V>;
Returns an iterator over a subset of entries in the skip list.
sourceimpl<K, V> SkipList<K, V> where
K: Ord + Send + 'static,
V: Send + 'static,
impl<K, V> SkipList<K, V> where
K: Ord + Send + 'static,
V: Send + 'static,
sourcepub fn insert(&self, key: K, value: V, guard: &Guard) -> RefEntry<'_, K, V>
pub fn insert(&self, key: K, value: V, guard: &Guard) -> RefEntry<'_, K, V>
Inserts a key
-value
pair into the skip list and returns the new entry.
If there is an existing entry with this key, it will be removed before inserting the new one.
sourcepub fn remove<Q>(&self, key: &Q, guard: &Guard) -> Option<RefEntry<'_, K, V>> where
K: Borrow<Q>,
Q: Ord + ?Sized,
pub fn remove<Q>(&self, key: &Q, guard: &Guard) -> Option<RefEntry<'_, K, V>> where
K: Borrow<Q>,
Q: Ord + ?Sized,
Removes an entry with the specified key
from the map and returns it.
sourcepub fn pop_front(&self, guard: &Guard) -> Option<RefEntry<'_, K, V>>
pub fn pop_front(&self, guard: &Guard) -> Option<RefEntry<'_, K, V>>
Removes an entry from the front of the skip list.
Trait Implementations
sourceimpl<K, V> IntoIterator for SkipList<K, V>
impl<K, V> IntoIterator for SkipList<K, V>
impl<K: Send + Sync, V: Send + Sync> Send for SkipList<K, V>
impl<K: Send + Sync, V: Send + Sync> Sync for SkipList<K, V>
Auto Trait Implementations
impl<K, V> !RefUnwindSafe for SkipList<K, V>
impl<K, V> Unpin for SkipList<K, V>
impl<K, V> !UnwindSafe for SkipList<K, V>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more