Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make KeyDeserialize trait public #692

Merged
merged 3 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/storage-plus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
14 changes: 12 additions & 2 deletions packages/storage-plus/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>,
{
pub fn range_raw<'c>(
&self,
Expand All @@ -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,
{
pub fn range<'c>(
&self,
store: &'c dyn Storage,
Expand Down Expand Up @@ -263,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;
Expand Down