|
27 | 27 | use self::hash_index::HashIndex; |
28 | 28 | use self::same_key_entry::SameKeyEntryIter; |
29 | 29 | use self::unique_direct_fixed_cap_index::{UniqueDirectFixedCapIndex, UniqueDirectFixedCapIndexRangeIter}; |
30 | | -use self::unique_direct_index::{UniqueDirectIndex, UniqueDirectIndexPointIter, UniqueDirectIndexRangeIter}; |
| 30 | +use self::unique_direct_index::{UniqueDirectIndex, UniqueDirectIndexRangeIter}; |
31 | 31 | use self::unique_hash_index::UniqueHashIndex; |
32 | 32 | use super::indexes::RowPointer; |
33 | 33 | use super::table::RowRef; |
@@ -58,28 +58,24 @@ pub use self::index::{Index, IndexCannotSeekRange, IndexSeekRangeResult, RangedI |
58 | 58 | pub use self::key_size::KeySize; |
59 | 59 |
|
60 | 60 | type BtreeIndex<K> = multimap::MultiMap<K>; |
61 | | -type BtreeIndexPointIter<'a> = SameKeyEntryIter<'a>; |
62 | 61 | type BtreeIndexRangeIter<'a, K> = multimap::MultiMapRangeIter<'a, K>; |
63 | 62 | type BtreeUniqueIndex<K> = uniquemap::UniqueMap<K>; |
64 | | -type BtreeUniqueIndexPointIter<'a> = uniquemap::UniqueMapPointIter<'a>; |
65 | 63 | type BtreeUniqueIndexRangeIter<'a, K> = uniquemap::UniqueMapRangeIter<'a, K>; |
66 | 64 |
|
67 | 65 | /// A point iterator over a [`TypedIndex`], with a specialized key type. |
68 | 66 | /// |
69 | 67 | /// See module docs for info about specialization. |
70 | 68 | enum TypedIndexPointIter<'a> { |
71 | | - BTree(BtreeIndexPointIter<'a>), |
72 | | - UniqueBTree(BtreeUniqueIndexPointIter<'a>), |
73 | | - UniqueDirect(UniqueDirectIndexPointIter), |
| 69 | + NonUnique(SameKeyEntryIter<'a>), |
| 70 | + Unique(uniquemap::UniquePointIter), |
74 | 71 | } |
75 | 72 |
|
76 | 73 | impl Iterator for TypedIndexPointIter<'_> { |
77 | 74 | type Item = RowPointer; |
78 | 75 | fn next(&mut self) -> Option<Self::Item> { |
79 | 76 | match self { |
80 | | - Self::BTree(this) => this.next(), |
81 | | - Self::UniqueBTree(this) => this.next(), |
82 | | - Self::UniqueDirect(this) => this.next(), |
| 77 | + Self::NonUnique(this) => this.next(), |
| 78 | + Self::Unique(this) => this.next(), |
83 | 79 | } |
84 | 80 | } |
85 | 81 | } |
@@ -961,85 +957,85 @@ impl TypedIndex { |
961 | 957 | use TypedIndex::*; |
962 | 958 | use TypedIndexPointIter::*; |
963 | 959 | match self { |
964 | | - BtreeBool(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_bool)), |
965 | | - BtreeU8(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_u8)), |
966 | | - BtreeSumTag(this) => BTree(iter_at_type(this, key, as_sum_tag)), |
967 | | - BtreeI8(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_i8)), |
968 | | - BtreeU16(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_u16)), |
969 | | - BtreeI16(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_i16)), |
970 | | - BtreeU32(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_u32)), |
971 | | - BtreeI32(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_i32)), |
972 | | - BtreeU64(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_u64)), |
973 | | - BtreeI64(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_i64)), |
974 | | - BtreeU128(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_u128)), |
975 | | - BtreeI128(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_i128)), |
976 | | - BtreeU256(this) => BTree(iter_at_type(this, key, |av| av.as_u256().map(|x| &**x))), |
977 | | - BtreeI256(this) => BTree(iter_at_type(this, key, |av| av.as_i256().map(|x| &**x))), |
978 | | - BtreeF32(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_f32)), |
979 | | - BtreeF64(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_f64)), |
980 | | - BtreeString(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_string)), |
981 | | - BtreeAV(this) => BTree(this.seek_point(key)), |
982 | | - HashBool(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_bool)), |
983 | | - HashU8(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_u8)), |
984 | | - HashSumTag(this) => BTree(iter_at_type(this, key, as_sum_tag)), |
985 | | - HashI8(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_i8)), |
986 | | - HashU16(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_u16)), |
987 | | - HashI16(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_i16)), |
988 | | - HashU32(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_u32)), |
989 | | - HashI32(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_i32)), |
990 | | - HashU64(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_u64)), |
991 | | - HashI64(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_i64)), |
992 | | - HashU128(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_u128)), |
993 | | - HashI128(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_i128)), |
994 | | - HashU256(this) => BTree(iter_at_type(this, key, |av| av.as_u256().map(|x| &**x))), |
995 | | - HashI256(this) => BTree(iter_at_type(this, key, |av| av.as_i256().map(|x| &**x))), |
996 | | - HashF32(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_f32)), |
997 | | - HashF64(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_f64)), |
998 | | - HashString(this) => BTree(iter_at_type(this, key, AlgebraicValue::as_string)), |
999 | | - HashAV(this) => BTree(this.seek_point(key)), |
1000 | | - UniqueBtreeBool(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_bool)), |
1001 | | - UniqueBtreeU8(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_u8)), |
1002 | | - UniqueBtreeSumTag(this) => UniqueBTree(iter_at_type(this, key, as_sum_tag)), |
1003 | | - UniqueBtreeI8(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_i8)), |
1004 | | - UniqueBtreeU16(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_u16)), |
1005 | | - UniqueBtreeI16(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_i16)), |
1006 | | - UniqueBtreeU32(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_u32)), |
1007 | | - UniqueBtreeI32(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_i32)), |
1008 | | - UniqueBtreeU64(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_u64)), |
1009 | | - UniqueBtreeI64(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_i64)), |
1010 | | - UniqueBtreeU128(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_u128)), |
1011 | | - UniqueBtreeI128(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_i128)), |
1012 | | - UniqueBtreeU256(this) => UniqueBTree(iter_at_type(this, key, |av| av.as_u256().map(|x| &**x))), |
1013 | | - UniqueBtreeI256(this) => UniqueBTree(iter_at_type(this, key, |av| av.as_i256().map(|x| &**x))), |
1014 | | - UniqueBtreeF32(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_f32)), |
1015 | | - UniqueBtreeF64(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_f64)), |
1016 | | - UniqueBtreeString(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_string)), |
1017 | | - UniqueBtreeAV(this) => UniqueBTree(this.seek_point(key)), |
1018 | | - |
1019 | | - UniqueHashBool(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_bool)), |
1020 | | - UniqueHashU8(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_u8)), |
1021 | | - UniqueHashSumTag(this) => UniqueBTree(iter_at_type(this, key, as_sum_tag)), |
1022 | | - UniqueHashI8(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_i8)), |
1023 | | - UniqueHashU16(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_u16)), |
1024 | | - UniqueHashI16(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_i16)), |
1025 | | - UniqueHashU32(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_u32)), |
1026 | | - UniqueHashI32(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_i32)), |
1027 | | - UniqueHashU64(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_u64)), |
1028 | | - UniqueHashI64(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_i64)), |
1029 | | - UniqueHashU128(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_u128)), |
1030 | | - UniqueHashI128(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_i128)), |
1031 | | - UniqueHashU256(this) => UniqueBTree(iter_at_type(this, key, |av| av.as_u256().map(|x| &**x))), |
1032 | | - UniqueHashI256(this) => UniqueBTree(iter_at_type(this, key, |av| av.as_i256().map(|x| &**x))), |
1033 | | - UniqueHashF32(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_f32)), |
1034 | | - UniqueHashF64(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_f64)), |
1035 | | - UniqueHashString(this) => UniqueBTree(iter_at_type(this, key, AlgebraicValue::as_string)), |
1036 | | - UniqueHashAV(this) => UniqueBTree(this.seek_point(key)), |
1037 | | - |
1038 | | - UniqueDirectSumTag(this) => UniqueDirect(iter_at_type(this, key, as_sum_tag)), |
1039 | | - UniqueDirectU8(this) => UniqueDirect(iter_at_type(this, key, AlgebraicValue::as_u8)), |
1040 | | - UniqueDirectU16(this) => UniqueDirect(iter_at_type(this, key, AlgebraicValue::as_u16)), |
1041 | | - UniqueDirectU32(this) => UniqueDirect(iter_at_type(this, key, AlgebraicValue::as_u32)), |
1042 | | - UniqueDirectU64(this) => UniqueDirect(iter_at_type(this, key, AlgebraicValue::as_u64)), |
| 960 | + BtreeBool(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_bool)), |
| 961 | + BtreeU8(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_u8)), |
| 962 | + BtreeSumTag(this) => NonUnique(iter_at_type(this, key, as_sum_tag)), |
| 963 | + BtreeI8(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_i8)), |
| 964 | + BtreeU16(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_u16)), |
| 965 | + BtreeI16(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_i16)), |
| 966 | + BtreeU32(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_u32)), |
| 967 | + BtreeI32(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_i32)), |
| 968 | + BtreeU64(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_u64)), |
| 969 | + BtreeI64(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_i64)), |
| 970 | + BtreeU128(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_u128)), |
| 971 | + BtreeI128(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_i128)), |
| 972 | + BtreeU256(this) => NonUnique(iter_at_type(this, key, |av| av.as_u256().map(|x| &**x))), |
| 973 | + BtreeI256(this) => NonUnique(iter_at_type(this, key, |av| av.as_i256().map(|x| &**x))), |
| 974 | + BtreeF32(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_f32)), |
| 975 | + BtreeF64(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_f64)), |
| 976 | + BtreeString(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_string)), |
| 977 | + BtreeAV(this) => NonUnique(this.seek_point(key)), |
| 978 | + HashBool(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_bool)), |
| 979 | + HashU8(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_u8)), |
| 980 | + HashSumTag(this) => NonUnique(iter_at_type(this, key, as_sum_tag)), |
| 981 | + HashI8(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_i8)), |
| 982 | + HashU16(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_u16)), |
| 983 | + HashI16(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_i16)), |
| 984 | + HashU32(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_u32)), |
| 985 | + HashI32(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_i32)), |
| 986 | + HashU64(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_u64)), |
| 987 | + HashI64(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_i64)), |
| 988 | + HashU128(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_u128)), |
| 989 | + HashI128(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_i128)), |
| 990 | + HashU256(this) => NonUnique(iter_at_type(this, key, |av| av.as_u256().map(|x| &**x))), |
| 991 | + HashI256(this) => NonUnique(iter_at_type(this, key, |av| av.as_i256().map(|x| &**x))), |
| 992 | + HashF32(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_f32)), |
| 993 | + HashF64(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_f64)), |
| 994 | + HashString(this) => NonUnique(iter_at_type(this, key, AlgebraicValue::as_string)), |
| 995 | + HashAV(this) => NonUnique(this.seek_point(key)), |
| 996 | + UniqueBtreeBool(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_bool)), |
| 997 | + UniqueBtreeU8(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u8)), |
| 998 | + UniqueBtreeSumTag(this) => Unique(iter_at_type(this, key, as_sum_tag)), |
| 999 | + UniqueBtreeI8(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_i8)), |
| 1000 | + UniqueBtreeU16(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u16)), |
| 1001 | + UniqueBtreeI16(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_i16)), |
| 1002 | + UniqueBtreeU32(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u32)), |
| 1003 | + UniqueBtreeI32(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_i32)), |
| 1004 | + UniqueBtreeU64(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u64)), |
| 1005 | + UniqueBtreeI64(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_i64)), |
| 1006 | + UniqueBtreeU128(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u128)), |
| 1007 | + UniqueBtreeI128(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_i128)), |
| 1008 | + UniqueBtreeU256(this) => Unique(iter_at_type(this, key, |av| av.as_u256().map(|x| &**x))), |
| 1009 | + UniqueBtreeI256(this) => Unique(iter_at_type(this, key, |av| av.as_i256().map(|x| &**x))), |
| 1010 | + UniqueBtreeF32(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_f32)), |
| 1011 | + UniqueBtreeF64(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_f64)), |
| 1012 | + UniqueBtreeString(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_string)), |
| 1013 | + UniqueBtreeAV(this) => Unique(this.seek_point(key)), |
| 1014 | + |
| 1015 | + UniqueHashBool(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_bool)), |
| 1016 | + UniqueHashU8(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u8)), |
| 1017 | + UniqueHashSumTag(this) => Unique(iter_at_type(this, key, as_sum_tag)), |
| 1018 | + UniqueHashI8(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_i8)), |
| 1019 | + UniqueHashU16(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u16)), |
| 1020 | + UniqueHashI16(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_i16)), |
| 1021 | + UniqueHashU32(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u32)), |
| 1022 | + UniqueHashI32(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_i32)), |
| 1023 | + UniqueHashU64(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u64)), |
| 1024 | + UniqueHashI64(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_i64)), |
| 1025 | + UniqueHashU128(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u128)), |
| 1026 | + UniqueHashI128(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_i128)), |
| 1027 | + UniqueHashU256(this) => Unique(iter_at_type(this, key, |av| av.as_u256().map(|x| &**x))), |
| 1028 | + UniqueHashI256(this) => Unique(iter_at_type(this, key, |av| av.as_i256().map(|x| &**x))), |
| 1029 | + UniqueHashF32(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_f32)), |
| 1030 | + UniqueHashF64(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_f64)), |
| 1031 | + UniqueHashString(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_string)), |
| 1032 | + UniqueHashAV(this) => Unique(this.seek_point(key)), |
| 1033 | + |
| 1034 | + UniqueDirectSumTag(this) => Unique(iter_at_type(this, key, as_sum_tag)), |
| 1035 | + UniqueDirectU8(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u8)), |
| 1036 | + UniqueDirectU16(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u16)), |
| 1037 | + UniqueDirectU32(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u32)), |
| 1038 | + UniqueDirectU64(this) => Unique(iter_at_type(this, key, AlgebraicValue::as_u64)), |
1043 | 1039 | } |
1044 | 1040 | } |
1045 | 1041 |
|
|
0 commit comments