diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bf24695..871f6269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 0.13.0 + +- Remove `Comparator` generic on `Entry*` + ## 0.12.0 - Bump `rarena-allocator`'s version diff --git a/Cargo.toml b/Cargo.toml index 978cc8fc..5d8931d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "skl" -version = "0.12.0" +version = "0.13.0" edition = "2021" rust-version = "1.56.0" repository = "https://github.com/al8n/skl" diff --git a/src/map.rs b/src/map.rs index c1af1a5f..5b8fca29 100644 --- a/src/map.rs +++ b/src/map.rs @@ -37,9 +37,9 @@ const CURRENT_VERSION: u16 = 0; /// The tombstone value size, if a node's value size is equal to this value, then it is a tombstone. const REMOVE: u32 = u32::MAX; -type UpdateOk<'a, 'b, T, C> = Either< - Option>, - Result, VersionedEntryRef<'a, T, C>>, +type UpdateOk<'a, 'b, T> = Either< + Option>, + Result, VersionedEntryRef<'a, T>>, >; #[derive(Debug)] @@ -1737,7 +1737,7 @@ impl SkipMap { failure: Ordering, ins: &mut Inserter, upsert: bool, - ) -> Result, Either> { + ) -> Result, Either> { let version = trailer.version(); // Safety: a fresh new Inserter, so safe here @@ -1745,7 +1745,7 @@ impl SkipMap { let (found, found_key, ptr) = self.find_splice(version, key.as_ref(), ins, true); if found { let node_ptr = ptr.expect("the NodePtr cannot be `None` when we found"); - let old = VersionedEntryRef::from_node(node_ptr, self); + let old = VersionedEntryRef::from_node(node_ptr, &self.arena); key.on_fail(&self.arena); @@ -1908,7 +1908,7 @@ impl SkipMap { let node_ptr = fr .curr .expect("the current should not be `None` when we found"); - let old = VersionedEntryRef::from_node(node_ptr, self); + let old = VersionedEntryRef::from_node(node_ptr, &self.arena); k.on_fail(&self.arena); @@ -1969,7 +1969,7 @@ impl SkipMap { #[allow(clippy::too_many_arguments)] unsafe fn upsert<'a, 'b: 'a, E>( &'a self, - old: VersionedEntryRef<'a, T, C>, + old: VersionedEntryRef<'a, T>, node_ptr: NodePtr, key: &Key<'a, 'b>, trailer: T, @@ -1977,7 +1977,7 @@ impl SkipMap { f: &impl Fn(&mut VacantBuffer<'a>) -> Result<(), E>, success: Ordering, failure: Ordering, - ) -> Result, Either> { + ) -> Result, Either> { match key { Key::Occupied(_) | Key::Vacant(_) | Key::Pointer { .. } => node_ptr .as_ref() @@ -1992,7 +1992,7 @@ impl SkipMap { let trailer = node.get_trailer_by_offset(&self.arena, offset); let value = node.get_value_by_offset(&self.arena, offset, len); Ok(Either::Right(Err(VersionedEntryRef { - map: self, + arena: &self.arena, key, trailer, value, diff --git a/src/map/api.rs b/src/map/api.rs index 6a67efe4..4c23d6d0 100644 --- a/src/map/api.rs +++ b/src/map/api.rs @@ -452,7 +452,7 @@ impl SkipMap { trailer: T, key: &'b [u8], value: &'b [u8], - ) -> Result>, Error> { + ) -> Result>, Error> { if self.arena.read_only() { return Err(Error::read_only()); } @@ -537,7 +537,7 @@ impl SkipMap { key: &'b [u8], value_size: u32, f: impl Fn(&mut VacantBuffer<'a>) -> Result<(), E>, - ) -> Result>, Either> { + ) -> Result>, Either> { if self.arena.read_only() { return Err(Either::Right(Error::read_only())); } @@ -575,7 +575,7 @@ impl SkipMap { trailer: T, key: &'b [u8], value: &'b [u8], - ) -> Result>, Error> { + ) -> Result>, Error> { if self.arena.read_only() { return Err(Error::read_only()); } @@ -661,7 +661,7 @@ impl SkipMap { key: &'b [u8], value_size: u32, f: impl Fn(&mut VacantBuffer<'a>) -> Result<(), E>, - ) -> Result>, Either> { + ) -> Result>, Either> { if self.arena.read_only() { return Err(Either::Right(Error::read_only())); } @@ -743,7 +743,7 @@ impl SkipMap { key: impl FnOnce(&mut VacantBuffer<'a>) -> Result<(), E>, val_size: u32, val: impl Fn(&mut VacantBuffer<'a>) -> Result<(), E>, - ) -> Result>, Either> { + ) -> Result>, Either> { let vk = self.fetch_vacant_key(u32::from(key_size), key)?; self @@ -821,7 +821,7 @@ impl SkipMap { key: impl FnOnce(&mut VacantBuffer<'a>) -> Result<(), E>, val_size: u32, val: impl Fn(&mut VacantBuffer<'a>) -> Result<(), E>, - ) -> Result>, Either> { + ) -> Result>, Either> { let vk = self.fetch_vacant_key(u32::from(key_size), key)?; self @@ -860,7 +860,7 @@ impl SkipMap { key: &'b [u8], success: Ordering, failure: Ordering, - ) -> Result>, Error> { + ) -> Result>, Error> { self .update( trailer, @@ -903,7 +903,7 @@ impl SkipMap { &'a self, trailer: T, key: &'b [u8], - ) -> Result>, Error> { + ) -> Result>, Error> { self .update( trailer, @@ -980,7 +980,7 @@ impl SkipMap { trailer: T, key_size: u27, key: impl FnOnce(&mut VacantBuffer<'a>) -> Result<(), E>, - ) -> Result>, Either> { + ) -> Result>, Either> { let vk = self.fetch_vacant_key(u32::from(key_size), key)?; let key = Key::RemoveVacant(vk); self @@ -1017,17 +1017,17 @@ impl SkipMap { } /// Returns the first entry in the map. - pub fn first(&self, version: u64) -> Option> { + pub fn first(&self, version: u64) -> Option> { self.iter(version).seek_lower_bound(Bound::Unbounded) } /// Returns the last entry in the map. - pub fn last(&self, version: u64) -> Option> { + pub fn last(&self, version: u64) -> Option> { self.iter(version).seek_upper_bound(Bound::Unbounded) } /// Returns the value associated with the given key, if it exists. - pub fn get<'a, 'b: 'a>(&'a self, version: u64, key: &'b [u8]) -> Option> { + pub fn get<'a, 'b: 'a>(&'a self, version: u64, key: &'b [u8]) -> Option> { unsafe { let (n, eq) = self.find_near(version, key, false, true); // findLessOrEqual. @@ -1038,7 +1038,7 @@ impl SkipMap { if eq { return value.map(|val| { EntryRef(VersionedEntryRef { - map: self, + arena: &self.arena, key: node_key, trailer, value: Some(val), @@ -1057,7 +1057,7 @@ impl SkipMap { value.map(|val| { EntryRef(VersionedEntryRef { - map: self, + arena: &self.arena, key: node_key, trailer, value: Some(val), @@ -1073,7 +1073,7 @@ impl SkipMap { &'a self, version: u64, upper: Bound<&'b [u8]>, - ) -> Option> { + ) -> Option> { self.iter(version).seek_upper_bound(upper) } @@ -1083,7 +1083,7 @@ impl SkipMap { &'a self, version: u64, lower: Bound<&'b [u8]>, - ) -> Option> { + ) -> Option> { self.iter(version).seek_lower_bound(lower) } diff --git a/src/map/entry.rs b/src/map/entry.rs index f2c5761e..88154fa1 100644 --- a/src/map/entry.rs +++ b/src/map/entry.rs @@ -1,23 +1,23 @@ -use core::cmp; +use rarena_allocator::Arena; -use super::{Comparator, NodePtr, SkipMap, Trailer}; +use super::{NodePtr, Trailer}; /// A versioned entry reference of the skipmap. /// /// Compared to the [`EntryRef`], this one's value can be `None` which means the entry is removed. #[derive(Debug)] -pub struct VersionedEntryRef<'a, T, C> { - pub(super) map: &'a SkipMap, +pub struct VersionedEntryRef<'a, T> { + pub(super) arena: &'a Arena, pub(super) key: &'a [u8], pub(super) trailer: T, pub(super) value: Option<&'a [u8]>, pub(super) ptr: NodePtr, } -impl<'a, T: Clone, C> Clone for VersionedEntryRef<'a, T, C> { +impl<'a, T: Clone> Clone for VersionedEntryRef<'a, T> { fn clone(&self) -> Self { Self { - map: self.map, + arena: self.arena, key: self.key, trailer: self.trailer.clone(), value: self.value, @@ -26,9 +26,9 @@ impl<'a, T: Clone, C> Clone for VersionedEntryRef<'a, T, C> { } } -impl<'a, T: Copy, C> Copy for VersionedEntryRef<'a, T, C> {} +impl<'a, T: Copy> Copy for VersionedEntryRef<'a, T> {} -impl<'a, T, C> VersionedEntryRef<'a, T, C> { +impl<'a, T> VersionedEntryRef<'a, T> { /// Returns the reference to the key #[inline] pub const fn key(&self) -> &[u8] { @@ -56,13 +56,12 @@ impl<'a, T, C> VersionedEntryRef<'a, T, C> { /// Returns the owned versioned entry, /// feel free to clone the entry if needed, no allocation and no deep clone will be made. #[inline] - pub fn to_owned(&self) -> VersionedEntry + pub fn to_owned(&self) -> VersionedEntry where T: Clone, - C: Clone, { VersionedEntry { - map: self.map.clone(), + arena: self.arena.clone(), trailer: self.trailer.clone(), ptr: self.ptr, } @@ -78,93 +77,61 @@ impl<'a, T, C> VersionedEntryRef<'a, T, C> { } } -impl<'a, T: Clone, C: Clone> From> for VersionedEntry { - fn from(entry: VersionedEntryRef<'a, T, C>) -> Self { +impl<'a, T: Clone> From> for VersionedEntry { + fn from(entry: VersionedEntryRef<'a, T>) -> Self { entry.to_owned() } } -impl<'a, T: Copy, C> VersionedEntryRef<'a, T, C> { - pub(super) fn from_node( - node_ptr: NodePtr, - map: &'a SkipMap, - ) -> VersionedEntryRef<'a, T, C> { +impl<'a, T: Copy> VersionedEntryRef<'a, T> { + pub(super) fn from_node(node_ptr: NodePtr, arena: &'a Arena) -> VersionedEntryRef<'a, T> { unsafe { let node = node_ptr.as_ref(); - let (trailer, value) = node.get_value_and_trailer(&map.arena); + let (trailer, value) = node.get_value_and_trailer(arena); VersionedEntryRef { - key: node.get_key(&map.arena), + key: node.get_key(arena), trailer, value, - map, + arena, ptr: node_ptr, } } } } -impl<'a, T: Trailer, C: Comparator> PartialEq for VersionedEntryRef<'a, T, C> { - fn eq(&self, other: &Self) -> bool { - self - .map - .cmp - .compare(self.key, other.key) - .then_with(|| self.version().cmp(&other.version())) - .is_eq() - } -} - -impl<'a, T: Trailer, C: Comparator> Eq for VersionedEntryRef<'a, T, C> {} - -impl<'a, T: Trailer, C: Comparator> PartialOrd for VersionedEntryRef<'a, T, C> { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl<'a, T: Trailer, C: Comparator> Ord for VersionedEntryRef<'a, T, C> { - fn cmp(&self, other: &Self) -> cmp::Ordering { - self - .map - .cmp - .compare(self.key, other.key) - .then_with(|| self.version().cmp(&other.version()).reverse()) - } -} - /// An owned versioned entry of the skipmap. /// /// Compared to the [`Entry`], this one's value can be `None` which means the entry is removed. #[derive(Debug)] -pub struct VersionedEntry { - pub(super) map: SkipMap, +pub struct VersionedEntry { + pub(super) arena: Arena, pub(super) trailer: T, pub(super) ptr: NodePtr, } -impl Clone for VersionedEntry { +impl Clone for VersionedEntry { fn clone(&self) -> Self { Self { - map: self.map.clone(), + arena: self.arena.clone(), trailer: self.trailer.clone(), ptr: self.ptr, } } } -impl<'a, T: Clone, C> From<&'a VersionedEntry> for VersionedEntryRef<'a, T, C> { - fn from(entry: &'a VersionedEntry) -> VersionedEntryRef<'a, T, C> { +impl<'a, T: Clone> From<&'a VersionedEntry> for VersionedEntryRef<'a, T> { + fn from(entry: &'a VersionedEntry) -> VersionedEntryRef<'a, T> { entry.borrow() } } -impl VersionedEntry { +impl VersionedEntry { /// Returns the reference to the key #[inline] pub fn key(&self) -> &[u8] { unsafe { let node = self.ptr.as_ref(); - node.get_key(&self.map.arena) + node.get_key(&self.arena) } } @@ -173,7 +140,7 @@ impl VersionedEntry { pub fn value(&self) -> Option<&[u8]> { unsafe { let node = self.ptr.as_ref(); - let value = node.get_value(&self.map.arena); + let value = node.get_value(&self.arena); value } } @@ -186,12 +153,12 @@ impl VersionedEntry { /// Returns the borrowed entry reference #[inline] - pub fn borrow(&self) -> VersionedEntryRef<'_, T, C> + pub fn borrow(&self) -> VersionedEntryRef<'_, T> where T: Clone, { VersionedEntryRef { - map: &self.map, + arena: &self.arena, key: self.key(), trailer: self.trailer.clone(), value: self.value(), @@ -213,21 +180,21 @@ impl VersionedEntry { /// /// Compared to the [`VersionedEntry`], this one's value cannot be `None`. #[derive(Debug)] -pub struct Entry(VersionedEntry); +pub struct Entry(VersionedEntry); -impl Clone for Entry { +impl Clone for Entry { fn clone(&self) -> Self { Self(self.0.clone()) } } -impl<'a, T: Clone, C> From<&'a Entry> for EntryRef<'a, T, C> { - fn from(entry: &'a Entry) -> Self { +impl<'a, T: Clone> From<&'a Entry> for EntryRef<'a, T> { + fn from(entry: &'a Entry) -> Self { entry.borrow() } } -impl Entry { +impl Entry { /// Returns the reference to the key #[inline] pub fn key(&self) -> &[u8] { @@ -251,7 +218,7 @@ impl Entry { /// Returns the borrowed entry reference #[inline] - pub fn borrow(&self) -> EntryRef<'_, T, C> + pub fn borrow(&self) -> EntryRef<'_, T> where T: Clone, { @@ -272,23 +239,23 @@ impl Entry { /// /// Compared to the [`VersionedEntryRef`], this one's value cannot be `None`. #[derive(Debug)] -pub struct EntryRef<'a, T, C>(pub(crate) VersionedEntryRef<'a, T, C>); +pub struct EntryRef<'a, T>(pub(crate) VersionedEntryRef<'a, T>); -impl<'a, T: Clone, C> Clone for EntryRef<'a, T, C> { +impl<'a, T: Clone> Clone for EntryRef<'a, T> { fn clone(&self) -> Self { Self(self.0.clone()) } } -impl<'a, T: Copy, C> Copy for EntryRef<'a, T, C> {} +impl<'a, T: Copy> Copy for EntryRef<'a, T> {} -impl<'a, T: Clone, C: Clone> From> for Entry { - fn from(entry: EntryRef<'a, T, C>) -> Self { +impl<'a, T: Clone> From> for Entry { + fn from(entry: EntryRef<'a, T>) -> Self { entry.to_owned() } } -impl<'a, T, C> EntryRef<'a, T, C> { +impl<'a, T> EntryRef<'a, T> { /// Returns the reference to the key #[inline] pub const fn key(&self) -> &[u8] { @@ -312,10 +279,9 @@ impl<'a, T, C> EntryRef<'a, T, C> { /// Returns the owned entry, feel free to clone the entry if needed, no allocation and no deep clone will be made. #[inline] - pub fn to_owned(&self) -> Entry + pub fn to_owned(&self) -> Entry where T: Clone, - C: Clone, { Entry(self.0.to_owned()) } @@ -329,23 +295,3 @@ impl<'a, T, C> EntryRef<'a, T, C> { self.0.version() } } - -impl<'a, T: Trailer, C: Comparator> PartialEq for EntryRef<'a, T, C> { - fn eq(&self, other: &Self) -> bool { - self.0.eq(&other.0) - } -} - -impl<'a, T: Trailer, C: Comparator> Eq for EntryRef<'a, T, C> {} - -impl<'a, T: Trailer, C: Comparator> PartialOrd for EntryRef<'a, T, C> { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl<'a, T: Trailer, C: Comparator> Ord for EntryRef<'a, T, C> { - fn cmp(&self, other: &Self) -> cmp::Ordering { - self.0.cmp(&other.0) - } -} diff --git a/src/map/iterator/all_versions.rs b/src/map/iterator/all_versions.rs index a04db111..2f1e9761 100644 --- a/src/map/iterator/all_versions.rs +++ b/src/map/iterator/all_versions.rs @@ -8,7 +8,7 @@ pub struct AllVersionsIter<'a, T, C, Q: ?Sized = &'static [u8], R = core::ops::R pub(super) version: u64, pub(super) range: R, pub(super) all_versions: bool, - pub(super) last: Option>, + pub(super) last: Option>, pub(super) _phantom: core::marker::PhantomData, } @@ -74,7 +74,7 @@ impl<'a, Q: ?Sized, R, T, C> AllVersionsIter<'a, T, C, Q, R> { /// Returns the entry at the current position of the iterator. #[inline] - pub const fn entry(&self) -> Option<&VersionedEntryRef<'a, T, C>> { + pub const fn entry(&self) -> Option<&VersionedEntryRef<'a, T>> { self.last.as_ref() } } @@ -89,15 +89,15 @@ where { /// Moves the iterator to the highest element whose key is below the given bound. /// If no such element is found then `None` is returned. - pub fn seek_upper_bound(&mut self, upper: Bound<&[u8]>) -> Option> { + pub fn seek_upper_bound(&mut self, upper: Bound<&[u8]>) -> Option> { match upper { Bound::Included(key) => self.seek_le(key).map(|n| { - let ent = VersionedEntryRef::from_node(n, self.map); + let ent = VersionedEntryRef::from_node(n, &self.map.arena); self.last = Some(ent); ent }), Bound::Excluded(key) => self.seek_lt(key).map(|n| { - let ent = VersionedEntryRef::from_node(n, self.map); + let ent = VersionedEntryRef::from_node(n, &self.map.arena); self.last = Some(ent); ent }), @@ -107,15 +107,15 @@ where /// Moves the iterator to the lowest element whose key is above the given bound. /// If no such element is found then `None` is returned. - pub fn seek_lower_bound(&mut self, lower: Bound<&[u8]>) -> Option> { + pub fn seek_lower_bound(&mut self, lower: Bound<&[u8]>) -> Option> { match lower { Bound::Included(key) => self.seek_ge(key).map(|n| { - let ent = VersionedEntryRef::from_node(n, self.map); + let ent = VersionedEntryRef::from_node(n, &self.map.arena); self.last = Some(ent); ent }), Bound::Excluded(key) => self.seek_gt(key).map(|n| { - let ent = VersionedEntryRef::from_node(n, self.map); + let ent = VersionedEntryRef::from_node(n, &self.map.arena); self.last = Some(ent); ent }), @@ -125,7 +125,7 @@ where /// Advances to the next position. Returns the key and value if the /// iterator is pointing at a valid entry, and `None` otherwise. - fn next_in(&mut self) -> Option> { + fn next_in(&mut self) -> Option> { loop { unsafe { self.nd = self.map.get_next(self.nd, 0); @@ -156,7 +156,7 @@ where if self.map.cmp.contains(&self.range, nk) { let ent = VersionedEntryRef { - map: self.map, + arena: &self.map.arena, key: nk, trailer, value, @@ -171,7 +171,7 @@ where /// Advances to the prev position. Returns the key and value if the /// iterator is pointing at a valid entry, and `None` otherwise. - fn prev(&mut self) -> Option> { + fn prev(&mut self) -> Option> { loop { unsafe { self.nd = self.map.get_prev(self.nd, 0); @@ -202,7 +202,7 @@ where if self.map.cmp.contains(&self.range, nk) { let ent = VersionedEntryRef { - map: self.map, + arena: &self.map.arena, key: nk, trailer, value, @@ -375,7 +375,7 @@ where /// Seeks position at the first entry in map. Returns the key and value /// if the iterator is pointing at a valid entry, and `None` otherwise. - fn first(&mut self) -> Option> { + fn first(&mut self) -> Option> { self.nd = self.map.first_in(self.version)?; loop { @@ -400,7 +400,7 @@ where if self.map.cmp.contains(&self.range, nk) { let ent = VersionedEntryRef { - map: self.map, + arena: &self.map.arena, key: nk, trailer, value, @@ -417,7 +417,7 @@ where /// Seeks position at the last entry in the iterator. Returns the key and value if /// the iterator is pointing at a valid entry, and `None` otherwise. - fn last(&mut self) -> Option> { + fn last(&mut self) -> Option> { self.nd = self.map.last_in(self.version)?; loop { @@ -442,7 +442,7 @@ where let nk = node.get_key(&self.map.arena); if self.map.cmp.contains(&self.range, nk) { let ent = VersionedEntryRef { - map: self.map, + arena: &self.map.arena, key: nk, trailer, value, @@ -465,7 +465,7 @@ where Q: ?Sized + PartialOrd<&'a [u8]>, R: RangeBounds, { - type Item = VersionedEntryRef<'a, T, C>; + type Item = VersionedEntryRef<'a, T>; #[inline] fn next(&mut self) -> Option { diff --git a/src/map/iterator/iter.rs b/src/map/iterator/iter.rs index d04b0eaf..67fa4b85 100644 --- a/src/map/iterator/iter.rs +++ b/src/map/iterator/iter.rs @@ -46,7 +46,7 @@ impl<'a, Q: ?Sized, R, T, C> Iter<'a, T, C, Q, R> { impl<'a, Q: ?Sized, R, T: Clone, C> Iter<'a, T, C, Q, R> { /// Returns the entry at the current position of the iterator. #[inline] - pub fn entry(&self) -> Option> { + pub fn entry(&self) -> Option> { self.0.last.clone().map(EntryRef) } } @@ -61,13 +61,13 @@ where { /// Moves the iterator to the highest element whose key is below the given bound. /// If no such element is found then `None` is returned. - pub fn seek_upper_bound(&mut self, upper: Bound<&[u8]>) -> Option> { + pub fn seek_upper_bound(&mut self, upper: Bound<&[u8]>) -> Option> { self.0.seek_upper_bound(upper).map(EntryRef) } /// Moves the iterator to the lowest element whose key is above the given bound. /// If no such element is found then `None` is returned. - pub fn seek_lower_bound(&mut self, lower: Bound<&[u8]>) -> Option> { + pub fn seek_lower_bound(&mut self, lower: Bound<&[u8]>) -> Option> { self.0.seek_lower_bound(lower).map(EntryRef) } } @@ -80,7 +80,7 @@ where Q: ?Sized + PartialOrd<&'a [u8]>, R: RangeBounds, { - type Item = EntryRef<'a, T, C>; + type Item = EntryRef<'a, T>; #[inline] fn next(&mut self) -> Option { @@ -94,24 +94,6 @@ where { self.0.last().map(EntryRef) } - - #[inline] - fn max(self) -> Option - where - Self: Sized, - Self::Item: Ord, - { - self.last() - } - - #[inline] - fn min(self) -> Option - where - Self: Sized, - Self::Item: Ord, - { - self.0.min().map(EntryRef) - } } impl<'a, Q, R, T, C> DoubleEndedIterator for Iter<'a, T, C, Q, R> diff --git a/src/map/tests.rs b/src/map/tests.rs index f4a083bf..84bd683d 100644 --- a/src/map/tests.rs +++ b/src/map/tests.rs @@ -311,21 +311,6 @@ fn basic_in(mut l: SkipMap) { assert!(l.get_or_insert(2, b"c", &[]).unwrap().is_none()); - { - #[allow(clippy::clone_on_copy)] - let a1 = l.get(1, b"a").unwrap().clone(); - let a2 = l.get(2, b"a").unwrap(); - assert!(a1 > a2); - assert_ne!(a1, a2); - let b1 = l.get(1, b"b").unwrap(); - let b2 = l.get(2, b"b").unwrap(); - assert!(b1 > b2); - assert_ne!(b1, b2); - let mut arr = [a1, a2, b1, b2]; - arr.sort(); - assert_eq!(arr, [a2, a1, b2, b1]); - } - unsafe { l.clear().unwrap(); } @@ -450,15 +435,6 @@ fn iter_all_versions_mvcc(l: SkipMap) { assert_eq!(ent.trailer().version(), 1); let mut it = l.iter_all_versions(3); - let ent = it.min().unwrap(); - assert_eq!(ent.key(), b"a"); - assert_eq!(ent.value().unwrap(), b"a2"); - assert_eq!(ent.trailer().version(), 3); - - let ent = it.max().unwrap(); - assert_eq!(ent.key(), b"c"); - assert_eq!(ent.value().unwrap(), b"c2"); - assert_eq!(ent.trailer().version(), 3); let ent = it.seek_upper_bound(Bound::Excluded(b"b")).unwrap(); assert_eq!(ent.key(), b"a");