mirror of
https://github.com/pezkuwichain/pezframe-metadata.git
synced 2026-04-22 11:17:57 +00:00
Combine Map/NMap/DoubleMap StorageEntryTypes (#23)
* Combine Map and NMap StorageEntryTypes * Fmt * Remove DoubleMap * Add comments to StorageEntryType::Map * Release 14.0.0-rc.2
This commit is contained in:
+10
-37
@@ -240,20 +240,11 @@ pub enum StorageHasher {
|
||||
pub enum StorageEntryType<T: Form = MetaForm> {
|
||||
Plain(T::Type),
|
||||
Map {
|
||||
hasher: StorageHasher,
|
||||
key: T::Type,
|
||||
value: T::Type,
|
||||
},
|
||||
DoubleMap {
|
||||
hasher: StorageHasher,
|
||||
key1: T::Type,
|
||||
key2: T::Type,
|
||||
value: T::Type,
|
||||
key2_hasher: StorageHasher,
|
||||
},
|
||||
NMap {
|
||||
keys: T::Type,
|
||||
/// One or more hashers, should be one hasher per key element.
|
||||
hashers: Vec<StorageHasher>,
|
||||
/// The type of the key, can be a tuple with elements for each of the hashers.
|
||||
key: T::Type,
|
||||
/// The type of the value.
|
||||
value: T::Type,
|
||||
},
|
||||
}
|
||||
@@ -264,33 +255,15 @@ impl IntoPortable for StorageEntryType {
|
||||
fn into_portable(self, registry: &mut Registry) -> Self::Output {
|
||||
match self {
|
||||
Self::Plain(plain) => StorageEntryType::Plain(registry.register_type(&plain)),
|
||||
Self::Map { hasher, key, value } => StorageEntryType::Map {
|
||||
hasher,
|
||||
Self::Map {
|
||||
hashers,
|
||||
key,
|
||||
value,
|
||||
} => StorageEntryType::Map {
|
||||
hashers,
|
||||
key: registry.register_type(&key),
|
||||
value: registry.register_type(&value),
|
||||
},
|
||||
Self::DoubleMap {
|
||||
hasher,
|
||||
key1,
|
||||
key2,
|
||||
value,
|
||||
key2_hasher,
|
||||
} => StorageEntryType::DoubleMap {
|
||||
hasher,
|
||||
key1: registry.register_type(&key1),
|
||||
key2: registry.register_type(&key2),
|
||||
value: registry.register_type(&value),
|
||||
key2_hasher,
|
||||
},
|
||||
StorageEntryType::NMap {
|
||||
keys,
|
||||
hashers,
|
||||
value,
|
||||
} => StorageEntryType::NMap {
|
||||
keys: registry.register_type(&keys),
|
||||
hashers,
|
||||
value: registry.register_type(&value),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user