mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 22:47:56 +00:00
generate_storage_alias: Rewrite as proc macro attribute (#11387)
* generate_storage_alias: Rewrite as proc macro attribute
This rewrites the `generate_storage_alias!` declarative macro as proc-macro attribute. While doing
this the name is changed to `storage_alias`. The prefix can now also be the name of a pallet. This
makes storage aliases work in migrations for all kind of chains and not just for the ones that use
predefined prefixes.
* Fix compilation and FMT
* Moare fixes
* 🤦
* ......
* Rework the syntax and support instancing
* FMT
* Prefix variants with `Storage`
* Make it compile
* Fix where clause on rust stable
This commit is contained in:
@@ -672,12 +672,15 @@ pub mod test {
|
||||
use crate::{bounded_vec, traits::ConstU32, Twox128};
|
||||
use sp_io::TestExternalities;
|
||||
|
||||
crate::generate_storage_alias! { Prefix, Foo => Value<BoundedVec<u32, ConstU32<7>>> }
|
||||
crate::generate_storage_alias! { Prefix, FooMap => Map<(Twox128, u32), BoundedVec<u32, ConstU32<7>>> }
|
||||
crate::generate_storage_alias! {
|
||||
Prefix,
|
||||
FooDoubleMap => DoubleMap<(Twox128, u32), (Twox128, u32), BoundedVec<u32, ConstU32<7>>>
|
||||
}
|
||||
#[crate::storage_alias]
|
||||
type Foo = StorageValue<Prefix, BoundedVec<u32, ConstU32<7>>>;
|
||||
|
||||
#[crate::storage_alias]
|
||||
type FooMap = StorageMap<Prefix, Twox128, u32, BoundedVec<u32, ConstU32<7>>>;
|
||||
|
||||
#[crate::storage_alias]
|
||||
type FooDoubleMap =
|
||||
StorageDoubleMap<Prefix, Twox128, u32, Twox128, u32, BoundedVec<u32, ConstU32<7>>>;
|
||||
|
||||
#[test]
|
||||
fn slide_works() {
|
||||
|
||||
Reference in New Issue
Block a user