@@ -15,62 +15,28 @@ use crate::{
1515 types:: { ManagedBuffer , ManagedType } ,
1616} ;
1717
18- #[ derive( Default , Clone ) ]
19- pub struct DynamicKey < A > ( StorageKey < A > )
20- where
21- A : ManagedTypeApi + ErrorApi + ' static ;
22-
23- impl < A > PartialEq for DynamicKey < A >
24- where
25- A : ManagedTypeApi + ErrorApi + ' static ,
26- {
27- fn eq ( & self , other : & Self ) -> bool {
28- self . 0 . eq ( & other. 0 )
29- }
30- }
31-
32- impl < A > Deref for DynamicKey < A >
33- where
34- A : ManagedTypeApi + ErrorApi + ' static ,
35- {
36- type Target = StorageKey < A > ;
37-
38- fn deref ( & self ) -> & Self :: Target {
39- & self . 0
40- }
41- }
42-
43- impl < A > DerefMut for DynamicKey < A >
44- where
45- A : ManagedTypeApi + ErrorApi + ' static ,
46- {
47- fn deref_mut ( & mut self ) -> & mut Self :: Target {
48- & mut self . 0
49- }
50- }
51-
5218#[ allow( dead_code) ]
5319pub trait Key < A > : ' static
5420where
5521 A : ManagedTypeApi + ErrorApi + ' static ,
5622{
57- fn full_key ( & self ) -> DynamicKey < A > ;
23+ fn full_key ( & self ) -> StorageKey < A > ;
5824
5925 fn key_eq < Other : Key < A > > ( & self , other : & Other ) -> bool {
6026 self . full_key ( ) . eq ( & other. full_key ( ) )
6127 }
6228
63- fn append_to ( & self , target : & mut DynamicKey < A > ) {
29+ fn append_to ( & self , target : & mut StorageKey < A > ) {
6430 target. append_bytes ( b"." ) ;
6531 target. append_managed_buffer ( & self . full_key ( ) . buffer ) ;
6632 }
6733}
6834
69- impl < A > Key < A > for DynamicKey < A >
35+ impl < A > Key < A > for StorageKey < A >
7036where
7137 A : ManagedTypeApi + ErrorApi + ' static ,
7238{
73- fn full_key ( & self ) -> DynamicKey < A > {
39+ fn full_key ( & self ) -> StorageKey < A > {
7440 self . clone ( )
7541 }
7642}
@@ -113,8 +79,8 @@ impl<A> Key<A> for StrKey
11379where
11480 A : ManagedTypeApi + ErrorApi + ' static ,
11581{
116- fn full_key ( & self ) -> DynamicKey < A > {
117- DynamicKey ( StorageKey :: new ( self . as_bytes ( ) ) )
82+ fn full_key ( & self ) -> StorageKey < A > {
83+ StorageKey :: new ( self . as_bytes ( ) )
11884 }
11985}
12086
@@ -198,7 +164,7 @@ where
198164 }
199165 }
200166
201- pub fn root_path ( self , root_key : & DynamicKey < A > ) -> SelfStorageRef < ' a , A > {
167+ pub fn root_path ( self , root_key : & StorageKey < A > ) -> SelfStorageRef < ' a , A > {
202168 SelfStorageRef {
203169 source_ref : self ,
204170 key : root_key. to_owned ( ) ,
@@ -229,7 +195,7 @@ where
229195 }
230196 }
231197
232- pub fn root_path ( self , root_key : & DynamicKey < A > ) -> SelfStorageRefMut < ' a , A > {
198+ pub fn root_path ( self , root_key : & StorageKey < A > ) -> SelfStorageRefMut < ' a , A > {
233199 SelfStorageRefMut {
234200 source_ref : self ,
235201 key : root_key. to_owned ( ) ,
@@ -258,7 +224,7 @@ where
258224 A : ManagedTypeApi + ErrorApi + ' static ,
259225{
260226 pub source_ref : SelfStorageRootRef < ' a , A > ,
261- pub key : DynamicKey < A > ,
227+ pub key : StorageKey < A > ,
262228}
263229
264230impl < ' a , A > StoragePath < A > for SelfStorageRef < ' a , A >
@@ -311,7 +277,7 @@ where
311277 A : ManagedTypeApi + ErrorApi + ' static ,
312278{
313279 pub source_ref : SelfStorageRootRefMut < ' a , A > ,
314- pub key : DynamicKey < A > ,
280+ pub key : StorageKey < A > ,
315281}
316282
317283impl < ' a , A > StoragePath < A > for SelfStorageRefMut < ' a , A >
@@ -403,7 +369,7 @@ pub fn _path_lifetimes<A>(root: SelfStorageRootRefMut<'_, A>)
403369where
404370 A : StorageWriteApi + StorageReadApi + ManagedTypeApi + ErrorApi + ' static ,
405371{
406- let mut path1 = root. root_path ( & DynamicKey ( StorageKey :: new ( b"root" ) ) ) ;
372+ let mut path1 = root. root_path ( & StorageKey :: new ( b"root" ) ) ;
407373 let _path1a = path1. as_ref_mut ( ) . concat_key ( StrKey ( "key1a" ) ) ;
408374 // let path1b = path1.into_ref_mut().concat_key("key1a".to_owned());
409375 // let path1a = path1.concat_key("key1a".to_owned());
0 commit comments