mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 12:48:00 +00:00
pallet macro: always generate storage info on pallet struct (#9246)
* always implement storage info on Pallet * fix UI test * Fold span computation into trait and method computation Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
committed by
GitHub
parent
f93074d086
commit
f96c5df754
@@ -499,6 +499,32 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// It doesn't require to implement `MaxEncodedLen` and give no information for `max_size`.
|
||||
impl<Prefix, Hasher1, Hasher2, Key1, Key2, Value, QueryKind, OnEmpty, MaxValues>
|
||||
crate::traits::PartialStorageInfoTrait for
|
||||
StorageDoubleMap<Prefix, Hasher1, Key1, Hasher2, Key2, Value, QueryKind, OnEmpty, MaxValues>
|
||||
where
|
||||
Prefix: StorageInstance,
|
||||
Hasher1: crate::hash::StorageHasher,
|
||||
Hasher2: crate::hash::StorageHasher,
|
||||
Key1: FullCodec,
|
||||
Key2: FullCodec,
|
||||
Value: FullCodec,
|
||||
QueryKind: QueryKindTrait<Value, OnEmpty>,
|
||||
OnEmpty: Get<QueryKind::Query> + 'static,
|
||||
MaxValues: Get<Option<u32>>,
|
||||
{
|
||||
fn partial_storage_info() -> Vec<StorageInfo> {
|
||||
vec![
|
||||
StorageInfo {
|
||||
prefix: Self::final_prefix(),
|
||||
max_values: MaxValues::get(),
|
||||
max_size: None
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
@@ -375,6 +375,30 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// It doesn't require to implement `MaxEncodedLen` and give no information for `max_size`.
|
||||
impl<Prefix, Hasher, Key, Value, QueryKind, OnEmpty, MaxValues>
|
||||
crate::traits::PartialStorageInfoTrait for
|
||||
StorageMap<Prefix, Hasher, Key, Value, QueryKind, OnEmpty, MaxValues>
|
||||
where
|
||||
Prefix: StorageInstance,
|
||||
Hasher: crate::hash::StorageHasher,
|
||||
Key: FullCodec,
|
||||
Value: FullCodec,
|
||||
QueryKind: QueryKindTrait<Value, OnEmpty>,
|
||||
OnEmpty: Get<QueryKind::Query> + 'static,
|
||||
MaxValues: Get<Option<u32>>,
|
||||
{
|
||||
fn partial_storage_info() -> Vec<StorageInfo> {
|
||||
vec![
|
||||
StorageInfo {
|
||||
prefix: Self::final_prefix(),
|
||||
max_values: MaxValues::get(),
|
||||
max_size: None,
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
@@ -430,6 +430,28 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// It doesn't require to implement `MaxEncodedLen` and give no information for `max_size`.
|
||||
impl<Prefix, Key, Value, QueryKind, OnEmpty, MaxValues>
|
||||
crate::traits::PartialStorageInfoTrait for
|
||||
StorageNMap<Prefix, Key, Value, QueryKind, OnEmpty, MaxValues>
|
||||
where
|
||||
Prefix: StorageInstance,
|
||||
Key: super::key::KeyGenerator,
|
||||
Value: FullCodec,
|
||||
QueryKind: QueryKindTrait<Value, OnEmpty>,
|
||||
OnEmpty: Get<QueryKind::Query> + 'static,
|
||||
MaxValues: Get<Option<u32>>,
|
||||
{
|
||||
fn partial_storage_info() -> Vec<StorageInfo> {
|
||||
vec![
|
||||
StorageInfo {
|
||||
prefix: Self::final_prefix(),
|
||||
max_values: MaxValues::get(),
|
||||
max_size: None,
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
@@ -228,6 +228,27 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// It doesn't require to implement `MaxEncodedLen` and give no information for `max_size`.
|
||||
impl<Prefix, Value, QueryKind, OnEmpty>
|
||||
crate::traits::PartialStorageInfoTrait for
|
||||
StorageValue<Prefix, Value, QueryKind, OnEmpty>
|
||||
where
|
||||
Prefix: StorageInstance,
|
||||
Value: FullCodec,
|
||||
QueryKind: QueryKindTrait<Value, OnEmpty>,
|
||||
OnEmpty: crate::traits::Get<QueryKind::Query> + 'static
|
||||
{
|
||||
fn partial_storage_info() -> Vec<StorageInfo> {
|
||||
vec![
|
||||
StorageInfo {
|
||||
prefix: Self::hashed_key(),
|
||||
max_values: Some(1),
|
||||
max_size: None,
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user