mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 02:31:03 +00:00
improve storage build type checking (#1914)
* force build closure in decl_storage! to return explicit type * fix when type was different Note: it breaks API but it is easy to upgrade: just do the conversion from encode type to the final type yourself in the build closure: ```rust Encode::using_encoded(&value, |mut value| Decode::decode(&mut v)).unwrap(); ```
This commit is contained in:
@@ -239,8 +239,6 @@ fn decl_store_extra_genesis(
|
||||
|
||||
let storage = (RefCell::new(&mut r), PhantomData::<Self>::default());
|
||||
let v = (#builder)(&self);
|
||||
let v = Encode::using_encoded(&v, |mut v| Decode::decode(&mut v))
|
||||
.expect(#error_message);
|
||||
<#name<#traitinstance> as #scrate::storage::generator::StorageValue<#typ>>::put(&v, &storage);
|
||||
}}
|
||||
},
|
||||
@@ -252,8 +250,6 @@ fn decl_store_extra_genesis(
|
||||
let storage = (RefCell::new(&mut r), PhantomData::<Self>::default());
|
||||
let data = (#builder)(&self);
|
||||
for (k, v) in data.into_iter() {
|
||||
let v = Encode::using_encoded(&v, |mut v| Decode::decode(&mut v))
|
||||
.expect(#error_message);
|
||||
<#name<#traitinstance> as #scrate::storage::generator::StorageMap<#key_type, #typ>>::insert(&k, &v, &storage);
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user