@@ -62,11 +62,7 @@ pub trait IndexedKey<T: Indexed> {
62
62
/// argument, which provides the necessary context for encryption and
63
63
/// decryption, in the case that certain components of the key must be
64
64
/// encrypted before storage.
65
- fn encode (
66
- room_id : & RoomId ,
67
- components : Self :: KeyComponents < ' _ > ,
68
- serializer : & IndexeddbSerializer ,
69
- ) -> Self ;
65
+ fn encode ( components : Self :: KeyComponents < ' _ > , serializer : & IndexeddbSerializer ) -> Self ;
70
66
}
71
67
72
68
/// A trait for constructing the bounds of an [`IndexedKey`].
@@ -103,12 +99,12 @@ where
103
99
{
104
100
/// Constructs the lower bound of the key.
105
101
fn lower_key ( room_id : & RoomId , serializer : & IndexeddbSerializer ) -> Self {
106
- <Self as IndexedKey < T > >:: encode ( room_id , Self :: lower_key_components ( ) , serializer)
102
+ <Self as IndexedKey < T > >:: encode ( Self :: lower_key_components ( ) , serializer)
107
103
}
108
104
109
105
/// Constructs the upper bound of the key.
110
106
fn upper_key ( room_id : & RoomId , serializer : & IndexeddbSerializer ) -> Self {
111
- <Self as IndexedKey < T > >:: encode ( room_id , Self :: upper_key_components ( ) , serializer)
107
+ <Self as IndexedKey < T > >:: encode ( Self :: upper_key_components ( ) , serializer)
112
108
}
113
109
}
114
110
@@ -153,6 +149,21 @@ pub trait IndexedPrefixKeyBounds<T: Indexed, P>: IndexedKey<T> {
153
149
fn upper_key_with_prefix ( prefix : P , serializer : & IndexeddbSerializer ) -> Self ;
154
150
}
155
151
152
+ impl < ' a , T , K , P > IndexedPrefixKeyBounds < T , P > for K
153
+ where
154
+ T : Indexed ,
155
+ K : IndexedPrefixKeyComponentBounds < ' a , T , P > + Sized ,
156
+ P : ' a ,
157
+ {
158
+ fn lower_key_with_prefix ( prefix : P , serializer : & IndexeddbSerializer ) -> Self {
159
+ <Self as IndexedKey < T > >:: encode ( Self :: lower_key_components_with_prefix ( prefix) , serializer)
160
+ }
161
+
162
+ fn upper_key_with_prefix ( prefix : P , serializer : & IndexeddbSerializer ) -> Self {
163
+ <Self as IndexedKey < T > >:: encode ( Self :: upper_key_components_with_prefix ( prefix) , serializer)
164
+ }
165
+ }
166
+
156
167
/// A trait for constructing the bounds of the components of an [`IndexedKey`]
157
168
/// given a prefix `P` of that key.
158
169
///
0 commit comments