pub struct BTreeIndex<K: Ord, V: Copy> { /* private fields */ }Expand description
A concurrent BTree index for range queries.
This index provides O(log n) lookup and efficient range scans.
Implementations§
Source§impl<K: Ord + Clone, V: Copy> BTreeIndex<K, V>
impl<K: Ord + Clone, V: Copy> BTreeIndex<K, V>
Sourcepub fn insert(&self, key: K, value: V) -> Option<V>
pub fn insert(&self, key: K, value: V) -> Option<V>
Inserts a key-value pair into the index.
Returns the previous value if the key was already present.
Sourcepub fn remove(&self, key: &K) -> Option<V>
pub fn remove(&self, key: &K) -> Option<V>
Removes a key from the index.
Returns the value if the key was present.
Sourcepub fn range<R: RangeBounds<K>>(&self, range: R) -> Vec<(K, V)>
pub fn range<R: RangeBounds<K>>(&self, range: R) -> Vec<(K, V)>
Returns all values in the given range.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> !Freeze for BTreeIndex<K, V>
impl<K, V> !RefUnwindSafe for BTreeIndex<K, V>
impl<K, V> Send for BTreeIndex<K, V>
impl<K, V> Sync for BTreeIndex<K, V>
impl<K, V> Unpin for BTreeIndex<K, V>
impl<K, V> UnwindSafe for BTreeIndex<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more