diff --git a/Cargo.toml b/Cargo.toml index e412ba0..9cf231d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "skl" -version = "0.22.7" +version = "0.22.8" edition = "2021" rust-version = "1.81.0" repository = "https://github.com/al8n/skl" diff --git a/src/dynamic.rs b/src/dynamic.rs index 3ed234f..aef3ca1 100644 --- a/src/dynamic.rs +++ b/src/dynamic.rs @@ -19,10 +19,6 @@ pub mod entry { pub use super::list::EntryRef; } -pub use dbutils::equivalentor::{BytesComparator, BytesEquivalentor, BytesRangeComparator}; - -/// Ascend is a comparator that compares byte slices in ascending order. -pub type Ascend = dbutils::equivalentor::Ascend<[u8]>; - -/// Ascend is a comparator that compares byte slices in ascending order. -pub type Descend = dbutils::equivalentor::Descend<[u8]>; +pub use dbutils::equivalentor::{ + Ascend, BytesComparator, BytesEquivalentor, BytesRangeComparator, Descend, +}; diff --git a/src/dynamic/builder.rs b/src/dynamic/builder.rs index e1175c8..30d9303 100644 --- a/src/dynamic/builder.rs +++ b/src/dynamic/builder.rs @@ -17,7 +17,7 @@ mod memmap; /// A builder for creating a dynamic key-value `SkipMap`. #[derive(Debug, Clone)] -pub struct Builder> { +pub struct Builder { options: Options, cmp: C, } diff --git a/src/dynamic/list.rs b/src/dynamic/list.rs index f9516b5..ca6c363 100644 --- a/src/dynamic/list.rs +++ b/src/dynamic/list.rs @@ -35,7 +35,7 @@ type UpdateOk<'a, 'b, A, RC, C> = Either< /// A fast, cocnurrent map implementation based on skiplist that supports forward /// and backward iteration. #[derive(Debug)] -pub struct SkipList> +pub struct SkipList where A: Allocator, R: RefCounter, diff --git a/src/dynamic/multiple_version.rs b/src/dynamic/multiple_version.rs index f8ac1b1..9535fde 100644 --- a/src/dynamic/multiple_version.rs +++ b/src/dynamic/multiple_version.rs @@ -48,7 +48,7 @@ pub mod unsync { /// /// If you want to use in concurrent environment, you can use [`multiple_version::sync::SkipMap`](crate::dynamic::multiple_version::sync::SkipMap). #[repr(transparent)] - pub struct SkipMap>(SkipList); + pub struct SkipMap(SkipList); impl Clone for SkipMap { #[inline] @@ -145,7 +145,7 @@ pub mod sync { /// /// If you want to use in non-concurrent environment, you can use [`multiple_version::unsync::SkipMap`](crate::dynamic::multiple_version::unsync::SkipMap). #[repr(transparent)] - pub struct SkipMap>(SkipList); + pub struct SkipMap(SkipList); impl Clone for SkipMap { #[inline] diff --git a/src/dynamic/unique.rs b/src/dynamic/unique.rs index 30b2a49..df2a0a8 100644 --- a/src/dynamic/unique.rs +++ b/src/dynamic/unique.rs @@ -48,7 +48,7 @@ pub mod unsync { /// /// If you want to use in concurrent environment, you can use [`unique::sync::SkipMap`](crate::dynamic::unique::sync::SkipMap). #[repr(transparent)] - pub struct SkipMap>(SkipList); + pub struct SkipMap(SkipList); impl Clone for SkipMap { #[inline] @@ -143,7 +143,7 @@ pub mod sync { /// /// If you want to use in non-concurrent environment, you can use [`unique::unsync::SkipMap`](crate::dynamic::unique::unsync::SkipMap). #[repr(transparent)] - pub struct SkipMap>(SkipList); + pub struct SkipMap(SkipList); impl Clone for SkipMap { #[inline] diff --git a/src/generic/builder.rs b/src/generic/builder.rs index d5b28de..9a0f7ea 100644 --- a/src/generic/builder.rs +++ b/src/generic/builder.rs @@ -16,7 +16,7 @@ mod memmap; /// A builder for creating a generic key-value `SkipMap`. #[derive(Debug)] -pub struct Builder> { +pub struct Builder { options: Options, cmp: C, } @@ -57,9 +57,9 @@ impl Builder { /// ## Example /// /// ```rust - /// use skl::generic::{Builder, Ascend}; + /// use skl::generic::{Builder, Descend}; /// - /// let builder = Builder::with(Ascend::<[u8]>::new()); + /// let builder = Builder::with(Descend::new()); /// ``` #[inline] pub const fn with(cmp: C) -> Self { @@ -78,7 +78,7 @@ impl Builder { /// ```rust /// use skl::generic::{Builder, Ascend}; /// - /// let builder = Builder::>::new(); + /// let builder = Builder::::new(); /// ``` #[inline] pub fn new() -> Self { @@ -97,7 +97,7 @@ impl Builder { /// ```rust /// use skl::generic::{Builder, Ascend}; /// - /// let builder = Builder::>::new().comparator(); + /// let builder = Builder::::new().comparator(); /// ``` #[inline] pub const fn comparator(&self) -> &C { @@ -109,11 +109,11 @@ impl Builder { /// ## Example /// /// ```rust - /// use skl::generic::{Builder, Ascend}; + /// use skl::generic::{Builder, Ascend, Descend}; /// - /// let builder = Builder::>::new().with_comparator(Ascend::>::new()); + /// let builder = Builder::::new().with_comparator(Descend::new()); /// - /// assert_eq!(builder.comparator(), &Ascend::>::new()); + /// assert_eq!(builder.comparator(), &Descend::new()); /// ``` #[inline] pub fn with_comparator(self, cmp: NC) -> Builder { @@ -128,9 +128,9 @@ impl Builder { /// ## Example /// /// ```rust - /// use skl::generic::{Builder, Ascend}; + /// use skl::generic::{Builder, Descend}; /// - /// let builder = Builder::>::new(); + /// let builder = Builder::::new(); /// let options = builder.options(); /// ``` #[inline] @@ -179,9 +179,9 @@ impl Builder { /// ```rust /// use skl::generic::{unique::sync, multiple_version::unsync, Builder, Ascend}; /// - /// let map = Builder::>::new().with_capacity(1024).alloc::>().unwrap(); + /// let map = Builder::::new().with_capacity(1024).alloc::>().unwrap(); /// - /// let arena = Builder::>::new().with_capacity(1024).alloc::>().unwrap(); + /// let arena = Builder::::new().with_capacity(1024).alloc::>().unwrap(); /// ``` #[inline] pub fn alloc(self) -> Result diff --git a/src/generic/builder/memmap.rs b/src/generic/builder/memmap.rs index c2c9080..101f62c 100644 --- a/src/generic/builder/memmap.rs +++ b/src/generic/builder/memmap.rs @@ -31,9 +31,9 @@ impl Builder { /// ```rust /// use skl::generic::{unique::sync, multiple_version::unsync, Builder, Ascend}; /// - /// let map = Builder::>::new().with_capacity(1024).map_anon::>().unwrap(); + /// let map = Builder::::new().with_capacity(1024).map_anon::>().unwrap(); /// - /// let arena = Builder::>::new().with_capacity(1024).map_anon::>().unwrap(); + /// let arena = Builder::::new().with_capacity(1024).map_anon::>().unwrap(); /// ``` #[cfg(all(feature = "memmap", not(target_family = "wasm")))] #[cfg_attr(docsrs, doc(cfg(all(feature = "memmap", not(target_family = "wasm")))))] diff --git a/src/generic/list.rs b/src/generic/list.rs index c53910c..b7674f1 100644 --- a/src/generic/list.rs +++ b/src/generic/list.rs @@ -562,7 +562,7 @@ where ) -> (Option<::Pointer>, bool) where Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { let mut x = self.head; let mut level = self.meta().height() as usize - 1; @@ -662,7 +662,7 @@ where returned_when_found: bool, ) -> (bool, Option, Option<::Pointer>) where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { let list_height = self.meta().height() as u32; let mut level = 0; @@ -741,7 +741,7 @@ where start: ::Pointer, ) -> FindResult<::Pointer> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { let mut prev = start; @@ -847,7 +847,7 @@ where key: Among<&'a [u8], &'b [u8], &'b K>, ) -> bool where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { let nd_key = self .arena @@ -909,7 +909,7 @@ where upsert: bool, ) -> Result, Among> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { let is_remove = key.is_remove(); @@ -1334,7 +1334,7 @@ where other: Either<&'a [u8], &K::Ref<'a>>, ) -> cmp::Ordering where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { match this { Among::Right(key) => match other { diff --git a/src/generic/list/api.rs b/src/generic/list/api.rs index 193f76c..4cf3c13 100644 --- a/src/generic/list/api.rs +++ b/src/generic/list/api.rs @@ -169,7 +169,7 @@ where pub fn contains_key<'a, Q>(&'a self, version: Version, key: &Q) -> bool where Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { self.get(version, key).is_some() } @@ -179,7 +179,7 @@ where pub fn contains_key_with_tombstone<'a, Q>(&'a self, version: Version, key: &Q) -> bool where Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { self.get_with_tombstone(version, key).is_some() } @@ -187,7 +187,7 @@ where /// Returns the first entry in the map. pub fn first<'a>(&'a self, version: Version) -> Option> where - C: TypeRefQueryComparator<'a, K::Ref<'a>, Type = K>, + C: TypeRefQueryComparator<'a, K, K::Ref<'a>>, { self.iter(version).next() } @@ -195,7 +195,7 @@ where /// Returns the last entry in the map. pub fn last<'a>(&'a self, version: Version) -> Option> where - C: TypeRefQueryComparator<'a, K::Ref<'a>, Type = K>, + C: TypeRefQueryComparator<'a, K, K::Ref<'a>>, { self.iter(version).last() } @@ -206,7 +206,7 @@ where version: Version, ) -> Option> where - C: TypeRefQueryComparator<'a, K::Ref<'a>, Type = K>, + C: TypeRefQueryComparator<'a, K, K::Ref<'a>>, { self.iter_with_tombstone(version).next() } @@ -217,7 +217,7 @@ where version: Version, ) -> Option> where - C: TypeRefQueryComparator<'a, K::Ref<'a>, Type = K>, + C: TypeRefQueryComparator<'a, K, K::Ref<'a>>, { self.iter_with_tombstone(version).last() } @@ -233,7 +233,7 @@ where ) -> Option> where Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { unsafe { let (n, eq) = self.find_near(version, key, false, true); // findLessOrEqual. @@ -279,7 +279,7 @@ where ) -> Option> where Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { unsafe { let (n, eq) = self.find_near(version, key, false, true); // findLessOrEqual. @@ -327,7 +327,7 @@ where ) -> Option> where Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { self.iter(version).map().seek_upper_bound(upper) } @@ -341,7 +341,7 @@ where ) -> Option> where Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { self.iter(version).map().seek_lower_bound(lower) } @@ -355,7 +355,7 @@ where ) -> Option> where Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { self .iter_with_tombstone(version) @@ -372,7 +372,7 @@ where ) -> Option> where Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { self .iter_with_tombstone(version) diff --git a/src/generic/list/api/update.rs b/src/generic/list/api/update.rs index 0d5cbe3..8e2752d 100644 --- a/src/generic/list/api/update.rs +++ b/src/generic/list/api/update.rs @@ -35,7 +35,7 @@ where value: impl Into>, ) -> Result>, Among> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.insert_at_height(version, self.random_height(), key, value) } @@ -53,7 +53,7 @@ where value: impl Into>, ) -> Result>, Among> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { let key: MaybeStructured<'_, K> = key.into(); let value: MaybeStructured<'_, V> = value.into(); @@ -107,7 +107,7 @@ where value_builder: ValueBuilder) -> Result>, ) -> Result>, Among> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { let key: MaybeStructured<'_, K> = key.into(); self @@ -150,7 +150,7 @@ where value: impl Into>, ) -> Result>, Among> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { let key: MaybeStructured<'_, K> = key.into(); let value: MaybeStructured<'_, V> = value.into(); @@ -204,7 +204,7 @@ where value_builder: ValueBuilder) -> Result>, ) -> Result>, Among> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { let key: MaybeStructured<'_, K> = key.into(); self @@ -252,7 +252,7 @@ where value_builder: ValueBuilder) -> Result>, ) -> Result>, Among> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .validate(height, key_builder.size(), value_builder.size()) @@ -308,7 +308,7 @@ where value_builder: ValueBuilder) -> Result>, ) -> Result>, Among> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .validate(height, key_builder.size(), value_builder.size()) @@ -365,7 +365,7 @@ where failure: Ordering, ) -> Result>, Either> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { let key: MaybeStructured<'_, K> = key.into(); self @@ -418,7 +418,7 @@ where key: impl Into>, ) -> Result>, Either> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { let key: MaybeStructured<'_, K> = key.into(); self @@ -470,7 +470,7 @@ where key_builder: KeyBuilder) -> Result>, ) -> Result>, Either> where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .validate(height, key_builder.size(), 0) diff --git a/src/generic/list/entry.rs b/src/generic/list/entry.rs index 76894cc..6a0224c 100644 --- a/src/generic/list/entry.rs +++ b/src/generic/list/entry.rs @@ -146,7 +146,7 @@ where S: State<'a>, A: Allocator, R: RefCounter, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { /// Returns the next entry in the map. #[inline] diff --git a/src/generic/list/iterator.rs b/src/generic/list/iterator.rs index d9d9e65..8a28acd 100644 --- a/src/generic/list/iterator.rs +++ b/src/generic/list/iterator.rs @@ -171,7 +171,7 @@ where RC: RefCounter, Q: ?Sized, R: RangeBounds, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { /// Advances to the next position. Returns the key and value if the /// iterator is pointing at a valid entry, and `None` otherwise. @@ -398,7 +398,7 @@ where RC: RefCounter, Q: ?Sized, R: RangeBounds, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { /// Moves the iterator to the highest element whose key is below the given bound. /// If no such element is found then `None` is returned. @@ -410,7 +410,7 @@ where ) -> Option> where QR: ?Sized, - C: TypeRefQueryComparator<'a, QR, Type = K>, + C: TypeRefQueryComparator<'a, K, QR>, { self.head = None; self.tail = None; @@ -436,7 +436,7 @@ where ) -> Option> where QR: ?Sized, - C: TypeRefQueryComparator<'a, QR, Type = K>, + C: TypeRefQueryComparator<'a, K, QR>, { self.head = None; self.tail = None; @@ -458,7 +458,7 @@ where fn seek_ge(&self, key: &QR) -> Option> where QR: ?Sized, - C: TypeRefQueryComparator<'a, QR, Type = K>, + C: TypeRefQueryComparator<'a, K, QR>, { unsafe { let (n, _) = self.map.find_near(self.version, key, false, true); @@ -496,7 +496,7 @@ where fn seek_gt(&self, key: &QR) -> Option> where QR: ?Sized, - C: TypeRefQueryComparator<'a, QR, Type = K>, + C: TypeRefQueryComparator<'a, K, QR>, { unsafe { let (n, _) = self.map.find_near(Version::MIN, key, false, false); @@ -534,7 +534,7 @@ where fn seek_le(&self, key: &QR) -> Option> where QR: ?Sized, - C: TypeRefQueryComparator<'a, QR, Type = K>, + C: TypeRefQueryComparator<'a, K, QR>, { unsafe { let (n, _) = self.map.find_near(Version::MIN, key, true, true); // find less or equal. @@ -572,7 +572,7 @@ where fn seek_lt(&self, key: &QR) -> Option> where QR: ?Sized, - C: TypeRefQueryComparator<'a, QR, Type = K>, + C: TypeRefQueryComparator<'a, K, QR>, { unsafe { let (n, _) = self.map.find_near(self.version, key, true, false); // find less or equal. @@ -631,7 +631,7 @@ where RC: RefCounter, Q: ?Sized, R: RangeBounds, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { type Item = EntryRef<'a, K, V, S, A, RC, C>; @@ -680,7 +680,7 @@ where RC: RefCounter, Q: ?Sized, R: RangeBounds, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { #[inline] fn next_back(&mut self) -> Option { @@ -697,7 +697,7 @@ fn above_lower_bound_compare<'a, C, V, T>(cmp: &C, bound: &Bound<&T>, other: &V: where V: ?Sized + Type, T: ?Sized, - C: TypeRefQueryComparator<'a, T, Type = V>, + C: TypeRefQueryComparator<'a, V, T>, { match *bound { Bound::Unbounded => true, @@ -709,7 +709,7 @@ where /// Helper function to check if a value is above a lower bound fn above_lower_bound<'a, C, K>(cmp: &C, bound: &Bound<&K::Ref<'a>>, other: &K::Ref<'a>) -> bool where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, K: ?Sized + Type, { match *bound { @@ -724,7 +724,7 @@ fn below_upper_bound_compare<'a, C, V, T>(cmp: &C, bound: &Bound<&T>, other: &V: where V: ?Sized + Type, T: ?Sized, - C: TypeRefQueryComparator<'a, T, Type = V>, + C: TypeRefQueryComparator<'a, V, T>, { match *bound { Bound::Unbounded => true, @@ -736,7 +736,7 @@ where /// Helper function to check if a value is below an upper bound fn below_upper_bound<'a, C, K>(cmp: &C, bound: &Bound<&K::Ref<'a>>, other: &K::Ref<'a>) -> bool where - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, K: ?Sized + Type, { match *bound { diff --git a/src/generic/multiple_version.rs b/src/generic/multiple_version.rs index 9a3686e..31ea967 100644 --- a/src/generic/multiple_version.rs +++ b/src/generic/multiple_version.rs @@ -34,25 +34,25 @@ pub mod unsync { crate::__generic_multiple_version_map_tests!("unsync_multiple_version_map": super::SkipMap<[u8], [u8]>); } - type SkipList> = super::super::list::SkipList; + type SkipList = super::super::list::SkipList; /// Iterator over the [`SkipMap`]. - pub type Iter<'a, K, V, S, C = Ascend> = + pub type Iter<'a, K, V, S, C = Ascend> = super::super::iter::Iter<'a, K, V, S, Allocator, RefCounter, C>; /// Iterator over a subset of the [`SkipMap`]. - pub type Range<'a, K, V, S, Q, R, C = Ascend> = + pub type Range<'a, K, V, S, Q, R, C = Ascend> = super::super::iter::Iter<'a, K, V, S, Allocator, RefCounter, C, Q, R>; /// The entry reference of the [`SkipMap`]. - pub type Entry<'a, K, V, S, C = Ascend> = + pub type Entry<'a, K, V, S, C = Ascend> = super::super::entry::EntryRef<'a, K, V, S, Allocator, RefCounter, C>; /// A fast, ARENA based `SkipMap` that supports multiple versions, forward and backward iteration. /// /// If you want to use in concurrent environment, you can use [`multiple_version::sync::SkipMap`](crate::generic::multiple_version::sync::SkipMap). #[repr(transparent)] - pub struct SkipMap>(SkipList); + pub struct SkipMap(SkipList); impl Clone for SkipMap { #[inline] @@ -138,25 +138,25 @@ pub mod sync { crate::__generic_multiple_version_map_tests!(go "sync_multiple_version_map": super::SkipMap<[u8], [u8]> => crate::tests::generic::TEST_OPTIONS_WITH_PESSIMISTIC_FREELIST); } - type SkipList> = super::super::list::SkipList; + type SkipList = super::super::list::SkipList; /// Iterator over the [`SkipMap`]. - pub type Iter<'a, K, V, S, C = Ascend> = + pub type Iter<'a, K, V, S, C = Ascend> = super::super::iter::Iter<'a, K, V, S, Allocator, RefCounter, C>; /// Iterator over a subset of the [`SkipMap`]. - pub type Range<'a, K, V, S, Q, R, C = Ascend> = + pub type Range<'a, K, V, S, Q, R, C = Ascend> = super::super::iter::Iter<'a, K, V, S, Allocator, RefCounter, C, Q, R>; /// The entry reference of the [`SkipMap`]. - pub type Entry<'a, K, V, S, C = Ascend> = + pub type Entry<'a, K, V, S, C = Ascend> = super::super::entry::EntryRef<'a, K, V, S, Allocator, RefCounter, C>; /// A fast, lock-free, thread-safe ARENA based `SkipMap` that supports multiple versions, forward and backward iteration. /// /// If you want to use in non-concurrent environment, you can use [`multiple_version::unsync::SkipMap`](crate::generic::multiple_version::unsync::SkipMap). #[repr(transparent)] - pub struct SkipMap>(SkipList); + pub struct SkipMap(SkipList); impl Clone for SkipMap { #[inline] @@ -209,7 +209,7 @@ pub mod sync { /// /// - For concurrent environment, use [`sync::SkipMap`]. /// - For non-concurrent environment, use [`unsync::SkipMap`]. -pub trait Map> +pub trait Map where K: ?Sized + 'static, V: ?Sized + 'static, @@ -351,7 +351,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { if !self.may_contain_version(version) { return false; @@ -382,7 +382,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { if !self.may_contain_version(version) { return false; @@ -400,7 +400,7 @@ where where K: Type, V: Type, - C: TypeRefQueryComparator<'a, K::Ref<'a>, Type = K>, + C: TypeRefQueryComparator<'a, K, K::Ref<'a>>, { if !self.may_contain_version(version) { return None; @@ -418,7 +418,7 @@ where where K: Type, V: Type, - C: TypeRefQueryComparator<'a, K::Ref<'a>, Type = K>, + C: TypeRefQueryComparator<'a, K, K::Ref<'a>>, { if !self.may_contain_version(version) { return None; @@ -439,7 +439,7 @@ where where K: Type, V: Type, - C: TypeRefQueryComparator<'a, K::Ref<'a>, Type = K>, + C: TypeRefQueryComparator<'a, K, K::Ref<'a>>, { if !self.may_contain_version(version) { return None; @@ -460,7 +460,7 @@ where where K: Type, V: Type, - C: TypeRefQueryComparator<'a, K::Ref<'a>, Type = K>, + C: TypeRefQueryComparator<'a, K, K::Ref<'a>>, { if !self.may_contain_version(version) { return None; @@ -500,7 +500,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { if !self.may_contain_version(version) { return None; @@ -540,7 +540,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { if !self.may_contain_version(version) { return None; @@ -561,7 +561,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { if !self.may_contain_version(version) { return None; @@ -582,7 +582,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { if !self.may_contain_version(version) { return None; @@ -606,7 +606,7 @@ where V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { if !self.may_contain_version(version) { return None; @@ -629,7 +629,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { if !self.may_contain_version(version) { return None; @@ -711,7 +711,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.as_ref().insert(version, key, value) } @@ -746,7 +746,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.as_ref().insert_at_height(version, height, key, value) } @@ -811,7 +811,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.as_ref().insert_at_height_with_value_builder( version, @@ -883,7 +883,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -909,7 +909,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -936,7 +936,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -1003,7 +1003,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.get_or_insert_at_height_with_value_builder( version, @@ -1076,7 +1076,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -1148,7 +1148,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.as_ref().insert_at_height_with_builders( version, @@ -1226,7 +1226,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -1296,7 +1296,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.as_ref().get_or_insert_at_height_with_builders( version, @@ -1371,7 +1371,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -1400,7 +1400,7 @@ where where K: Type + 'b, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.compare_remove_at_height(version, self.random_height(), key, success, failure) } @@ -1428,7 +1428,7 @@ where where K: Type + 'b, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -1453,7 +1453,7 @@ where where K: Type + 'b, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.get_or_remove_at_height(version, self.random_height(), key) } @@ -1490,7 +1490,7 @@ where where K: Type + 'b, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.as_ref().get_or_remove_at_height(version, height, key) } @@ -1551,7 +1551,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -1616,7 +1616,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() diff --git a/src/generic/unique.rs b/src/generic/unique.rs index 719ec53..a010c6a 100644 --- a/src/generic/unique.rs +++ b/src/generic/unique.rs @@ -34,25 +34,25 @@ pub mod unsync { crate::__generic_map_tests!("unsync_map": super::SkipMap<[u8], [u8]>); } - type SkipList> = super::super::list::SkipList; + type SkipList = super::super::list::SkipList; /// Iterator over the [`SkipMap`]. - pub type Iter<'a, K, V, C = Ascend> = + pub type Iter<'a, K, V, C = Ascend> = super::super::iter::Iter<'a, K, V, Active, Allocator, RefCounter, C>; /// Iterator over a subset of the [`SkipMap`]. - pub type Range<'a, K, V, Q, R, C = Ascend> = + pub type Range<'a, K, V, Q, R, C = Ascend> = super::super::iter::Iter<'a, K, V, Active, Allocator, RefCounter, C, Q, R>; /// The entry reference of the [`SkipMap`]. - pub type Entry<'a, K, V, C = Ascend> = + pub type Entry<'a, K, V, C = Ascend> = super::super::entry::EntryRef<'a, K, V, Active, Allocator, RefCounter, C>; /// A fast, ARENA based `SkipMap` that supports forward and backward iteration. /// /// If you want to use in concurrent environment, you can use [`unique::sync::SkipMap`](crate::generic::unique::sync::SkipMap). #[repr(transparent)] - pub struct SkipMap>(SkipList); + pub struct SkipMap(SkipList); impl Clone for SkipMap { #[inline] @@ -133,25 +133,25 @@ pub mod sync { crate::__generic_map_tests!(go "sync_map": super::SkipMap<[u8], [u8]> => crate::tests::generic::TEST_OPTIONS_WITH_PESSIMISTIC_FREELIST); } - type SkipList> = super::super::list::SkipList; + type SkipList = super::super::list::SkipList; /// Iterator over the [`SkipMap`]. - pub type Iter<'a, K, V, C = Ascend> = + pub type Iter<'a, K, V, C = Ascend> = super::super::iter::Iter<'a, K, V, Active, Allocator, RefCounter, C>; /// Iterator over a subset of the [`SkipMap`]. - pub type Range<'a, K, V, Q, R, C = Ascend> = + pub type Range<'a, K, V, Q, R, C = Ascend> = super::super::iter::Iter<'a, K, V, Active, Allocator, RefCounter, C, Q, R>; /// The entry reference of the [`SkipMap`]. - pub type Entry<'a, K, V, C = Ascend> = + pub type Entry<'a, K, V, C = Ascend> = super::super::entry::EntryRef<'a, K, V, Active, Allocator, RefCounter, C>; /// A fast, lock-free, thread-safe ARENA based `SkipMap` that supports forward and backward iteration. /// /// If you want to use in non-concurrent environment, you can use [`unique::unsync::SkipMap`](crate::generic::unique::unsync::SkipMap). #[repr(transparent)] - pub struct SkipMap>(SkipList); + pub struct SkipMap(SkipList); impl Clone for SkipMap { #[inline] @@ -204,7 +204,7 @@ pub mod sync { /// /// - For concurrent environment, use [`sync::SkipMap`]. /// - For non-concurrent environment, use [`unsync::SkipMap`]. -pub trait Map> +pub trait Map where K: ?Sized + 'static, V: ?Sized + 'static, @@ -316,7 +316,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { self.as_ref().contains_key(MIN_VERSION, key) } @@ -327,7 +327,7 @@ where where K: Type, V: Type, - C: TypeRefQueryComparator<'a, K::Ref<'a>, Type = K>, + C: TypeRefQueryComparator<'a, K, K::Ref<'a>>, { self.as_ref().first(MIN_VERSION) } @@ -338,7 +338,7 @@ where where K: Type, V: Type, - C: TypeRefQueryComparator<'a, K::Ref<'a>, Type = K>, + C: TypeRefQueryComparator<'a, K, K::Ref<'a>>, { self.as_ref().last(MIN_VERSION) } @@ -370,7 +370,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { self.as_ref().get(MIN_VERSION, key) } @@ -386,7 +386,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { self.as_ref().upper_bound(MIN_VERSION, upper) } @@ -402,7 +402,7 @@ where K: Type, V: Type, Q: ?Sized, - C: TypeRefQueryComparator<'a, Q, Type = K>, + C: TypeRefQueryComparator<'a, K, Q>, { self.as_ref().lower_bound(MIN_VERSION, lower) } @@ -449,7 +449,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.insert_at_height(self.random_height(), key, value) } @@ -483,7 +483,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -550,7 +550,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.insert_at_height_with_value_builder(self.random_height(), key, value_builder) } @@ -617,7 +617,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -642,7 +642,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.get_or_insert_at_height(self.random_height(), key, value) } @@ -666,7 +666,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -733,7 +733,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.get_or_insert_at_height_with_value_builder(self.random_height(), key, value_builder) } @@ -801,7 +801,7 @@ where where K: Type + 'b, V: Type + 'b, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.as_ref().get_or_insert_at_height_with_value_builder( MIN_VERSION, @@ -875,7 +875,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.insert_at_height_with_builders(self.random_height(), key_builder, value_builder) } @@ -947,7 +947,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -1016,7 +1016,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.get_or_insert_at_height_with_builders(self.random_height(), key_builder, value_builder) } @@ -1085,7 +1085,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.as_ref().get_or_insert_at_height_with_builders( MIN_VERSION, @@ -1114,7 +1114,7 @@ where where K: Type + 'b, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.remove_at_height(self.random_height(), key) } @@ -1140,7 +1140,7 @@ where where K: Type + 'b, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.as_ref().compare_remove_at_height( MIN_VERSION, @@ -1168,7 +1168,7 @@ where where K: Type + 'b, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.get_or_remove_at_height(self.random_height(), key) } @@ -1205,7 +1205,7 @@ where where K: Type + 'b, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() @@ -1267,7 +1267,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self.get_or_remove_at_height_with_builder(self.random_height(), key_builder) } @@ -1329,7 +1329,7 @@ where where K: Type, V: Type, - C: TypeRefComparator<'a, Type = K>, + C: TypeRefComparator<'a, K>, { self .as_ref() diff --git a/src/tests/generic.rs b/src/tests/generic.rs index e9136a7..13e51e7 100644 --- a/src/tests/generic.rs +++ b/src/tests/generic.rs @@ -24,15 +24,15 @@ use crate::generic::{Ascend, Builder}; use super::*; -pub(crate) const TEST_OPTIONS: Builder> = +pub(crate) const TEST_OPTIONS: Builder = Builder::with(Ascend::new()).with_capacity(ARENA_SIZE as u32); -pub(crate) const TEST_FULL_OPTIONS: Builder> = +pub(crate) const TEST_FULL_OPTIONS: Builder = Builder::with(Ascend::new()).with_capacity(1024); -pub(crate) const TEST_OPTIONS_WITH_OPTIMISTIC_FREELIST: Builder> = +pub(crate) const TEST_OPTIONS_WITH_OPTIMISTIC_FREELIST: Builder = Builder::with(Ascend::new()) .with_capacity(ARENA_SIZE as u32) .with_freelist(rarena_allocator::Freelist::Optimistic); -pub(crate) const TEST_OPTIONS_WITH_PESSIMISTIC_FREELIST: Builder> = +pub(crate) const TEST_OPTIONS_WITH_PESSIMISTIC_FREELIST: Builder = Builder::with(Ascend::new()) .with_capacity(ARENA_SIZE as u32) .with_freelist(rarena_allocator::Freelist::Pessimistic); @@ -63,5 +63,5 @@ const BIG_ARENA_SIZE: usize = 120 << 20; test_generic_sync_versioned, ) ))] -pub(crate) const BIG_TEST_OPTIONS: Builder> = +pub(crate) const BIG_TEST_OPTIONS: Builder = Builder::with(Ascend::new()).with_capacity(BIG_ARENA_SIZE as u32);