mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-25 10:41:08 +00:00
implemented contains_prefix for StorageDoubleMap and StorageNMap (#13232)
* implemented `contains_prefix` for StorageDoubleMap and StorageNMap Signed-off-by: muraca <mmuraca247@gmail.com> * match prefix to next_key Signed-off-by: muraca <mmuraca247@gmail.com> * warning unexpected behaviour with empty keys Signed-off-by: muraca <mmuraca247@gmail.com> * clarifications for unhashed::contains_prefixed_key Signed-off-by: muraca <mmuraca247@gmail.com> * added tests for StorageNMap Signed-off-by: muraca <mmuraca247@gmail.com> --------- Signed-off-by: muraca <mmuraca247@gmail.com>
This commit is contained in:
@@ -233,6 +233,13 @@ where
|
||||
.into()
|
||||
}
|
||||
|
||||
fn contains_prefix<KArg1>(k1: KArg1) -> bool
|
||||
where
|
||||
KArg1: EncodeLike<K1>,
|
||||
{
|
||||
unhashed::contains_prefixed_key(Self::storage_double_map_final_key1(k1).as_ref())
|
||||
}
|
||||
|
||||
fn iter_prefix_values<KArg1>(k1: KArg1) -> storage::PrefixIterator<V>
|
||||
where
|
||||
KArg1: ?Sized + EncodeLike<K1>,
|
||||
|
||||
@@ -208,6 +208,13 @@ where
|
||||
)
|
||||
}
|
||||
|
||||
fn contains_prefix<KP>(partial_key: KP) -> bool
|
||||
where
|
||||
K: HasKeyPrefix<KP>,
|
||||
{
|
||||
unhashed::contains_prefixed_key(&Self::storage_n_map_partial_key(partial_key))
|
||||
}
|
||||
|
||||
fn iter_prefix_values<KP>(partial_key: KP) -> PrefixIterator<V>
|
||||
where
|
||||
K: HasKeyPrefix<KP>,
|
||||
|
||||
Reference in New Issue
Block a user