mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
Fix decl_storage map and linked_map for insert_ref (#3316)
* test * fix * bumpd version * Update srml/support/procedural/src/storage/impls.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -615,6 +615,27 @@ impl<'a, I: Iterator<Item=syn::Meta>> Impls<'a, I> {
|
||||
storage.put(key_for, &(val, linkage))
|
||||
}
|
||||
|
||||
/// Store a value under this key into the provided storage instance; this can take any reference
|
||||
/// type that derefs to `T` (and has `Encode` implemented).
|
||||
/// Store a value under this key into the provided storage instance.
|
||||
fn insert_ref<Arg, S>(key: &#kty, val: &Arg, storage: &mut S)
|
||||
where
|
||||
#typ: AsRef<Arg>,
|
||||
Arg: ?Sized + #scrate::codec::Encode,
|
||||
S: #scrate::HashedStorage<#scrate::#hasher>
|
||||
{
|
||||
use self::#inner_module::Utils;
|
||||
|
||||
let key_for = &*#as_map::key_for(key);
|
||||
let linkage = match Self::read_with_linkage(storage, key_for) {
|
||||
// overwrite but reuse existing linkage
|
||||
Some((_data, linkage)) => linkage,
|
||||
// create new linkage
|
||||
None => Self::new_head_linkage(storage, key),
|
||||
};
|
||||
storage.put(key_for, &(val, linkage))
|
||||
}
|
||||
|
||||
/// Mutate the value under a key
|
||||
fn mutate<R, F, S>(key: &#kty, f: F, storage: &mut S) -> R
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user