From 40b5b1587f6952d1320cf3d1c27e2f2b0c287f5a Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Sun, 27 Mar 2022 08:55:24 +0200 Subject: [PATCH 1/3] Make KeyDeserialize trait public --- packages/storage-plus/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/storage-plus/src/lib.rs b/packages/storage-plus/src/lib.rs index 0d6e464c9..7035d9a25 100644 --- a/packages/storage-plus/src/lib.rs +++ b/packages/storage-plus/src/lib.rs @@ -18,6 +18,7 @@ mod snapshot; #[cfg(feature = "iterator")] pub use bound::{Bound, Bounder, PrefixBound, RawBound}; +pub use de::KeyDeserialize; pub use endian::Endian; #[cfg(feature = "iterator")] pub use indexed_map::{IndexList, IndexedMap}; From bffc70fda438ca23371d2a9590f77141d76bd333 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Sun, 27 Mar 2022 11:38:20 +0200 Subject: [PATCH 2/3] Fix required trait bounds on raw Map iterators --- packages/storage-plus/src/map.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/storage-plus/src/map.rs b/packages/storage-plus/src/map.rs index 398521f3a..82da70a37 100644 --- a/packages/storage-plus/src/map.rs +++ b/packages/storage-plus/src/map.rs @@ -196,7 +196,7 @@ where impl<'a, K, T> Map<'a, K, T> where T: Serialize + DeserializeOwned, - K: PrimaryKey<'a> + KeyDeserialize + Bounder<'a>, + K: PrimaryKey<'a> + Bounder<'a>, { pub fn range_raw<'c>( &self, @@ -223,7 +223,14 @@ where { self.no_prefix_raw().keys_raw(store, min, max, order) } +} +#[cfg(feature = "iterator")] +impl<'a, K, T> Map<'a, K, T> +where + T: Serialize + DeserializeOwned, + K: PrimaryKey<'a> + KeyDeserialize + Bounder<'a>, +{ pub fn range<'c>( &self, store: &'c dyn Storage, From b07ce13d394000b79dc4a46a7ae15c16777b2f00 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Sun, 27 Mar 2022 11:45:27 +0200 Subject: [PATCH 3/3] Remove optional Bounder trait bound --- packages/storage-plus/src/map.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/storage-plus/src/map.rs b/packages/storage-plus/src/map.rs index 82da70a37..eee46f5c1 100644 --- a/packages/storage-plus/src/map.rs +++ b/packages/storage-plus/src/map.rs @@ -3,7 +3,7 @@ use serde::Serialize; use std::marker::PhantomData; #[cfg(feature = "iterator")] -use crate::bound::{Bound, Bounder, PrefixBound}; +use crate::bound::{Bound, PrefixBound}; #[cfg(feature = "iterator")] use crate::de::KeyDeserialize; use crate::helpers::query_raw; @@ -196,7 +196,7 @@ where impl<'a, K, T> Map<'a, K, T> where T: Serialize + DeserializeOwned, - K: PrimaryKey<'a> + Bounder<'a>, + K: PrimaryKey<'a>, { pub fn range_raw<'c>( &self, @@ -229,7 +229,7 @@ where impl<'a, K, T> Map<'a, K, T> where T: Serialize + DeserializeOwned, - K: PrimaryKey<'a> + KeyDeserialize + Bounder<'a>, + K: PrimaryKey<'a> + KeyDeserialize, { pub fn range<'c>( &self, @@ -270,6 +270,9 @@ mod test { #[cfg(feature = "iterator")] use cosmwasm_std::{Order, StdResult}; + #[cfg(feature = "iterator")] + use crate::bound::Bounder; + use crate::int_key::CwIntKey; #[cfg(feature = "iterator")] use crate::IntKeyOld;