mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 18:37:59 +00:00
Use EncodeLike for storages traits (#3676)
* impl * patch * lock * some refactor * some avoided copy * new api without ref for doublemap * fix * version bump * fix * point to incoming release * use codec latest * bumpd impl version * fix unused * fix * Update srml/support/src/storage/mod.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
committed by
Bastian Köcher
parent
83d4764d46
commit
53e0ddee4e
@@ -338,7 +338,7 @@ fn decl_store_extra_genesis(
|
||||
<
|
||||
#name<#struct_trait #instance> as
|
||||
#scrate::storage::StorageValue<#typ>
|
||||
>::put(&v);
|
||||
>::put::<#typ>(v);
|
||||
}}
|
||||
},
|
||||
DeclStorageTypeInfosKind::Map { key_type, is_linked, .. } => {
|
||||
@@ -363,7 +363,7 @@ fn decl_store_extra_genesis(
|
||||
<
|
||||
#name<#struct_trait #instance> as
|
||||
#scrate::storage::#map<#key_type, #typ>
|
||||
>::insert(&k, &v);
|
||||
>::insert::<#key_type, #typ>(k, v);
|
||||
});
|
||||
}}
|
||||
},
|
||||
@@ -384,7 +384,7 @@ fn decl_store_extra_genesis(
|
||||
<
|
||||
#name<#struct_trait #instance> as
|
||||
#scrate::storage::StorageDoubleMap<#key1_type, #key2_type, #typ>
|
||||
>::insert(&k1, &k2, &v);
|
||||
>::insert::<#key1_type, #key2_type, #typ>(k1, k2, v);
|
||||
});
|
||||
}}
|
||||
},
|
||||
@@ -927,11 +927,11 @@ fn impl_store_fns(
|
||||
|
||||
quote!{
|
||||
#( #[ #attrs ] )*
|
||||
pub fn #get_fn<K: #scrate::rstd::borrow::Borrow<#key_type>>(key: K) -> #value_type {
|
||||
pub fn #get_fn<K: #scrate::codec::EncodeLike<#key_type>>(key: K) -> #value_type {
|
||||
<
|
||||
#name<#struct_trait #instance> as
|
||||
#scrate::storage::#map<#key_type, #typ>
|
||||
>::get(key.borrow())
|
||||
>::get(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -946,12 +946,10 @@ fn impl_store_fns(
|
||||
};
|
||||
|
||||
quote!{
|
||||
pub fn #get_fn<KArg1, KArg2>(k1: &KArg1, k2: &KArg2) -> #value_type
|
||||
pub fn #get_fn<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> #value_type
|
||||
where
|
||||
#key1_type: #scrate::rstd::borrow::Borrow<KArg1>,
|
||||
#key2_type: #scrate::rstd::borrow::Borrow<KArg2>,
|
||||
KArg1: ?Sized + #scrate::codec::Encode,
|
||||
KArg2: ?Sized + #scrate::codec::Encode,
|
||||
KArg1: #scrate::codec::EncodeLike<#key1_type>,
|
||||
KArg2: #scrate::codec::EncodeLike<#key2_type>,
|
||||
{
|
||||
<
|
||||
#name<#struct_trait #instance> as
|
||||
|
||||
Reference in New Issue
Block a user