Skip to content

Commit

Permalink
(Manually) simplify no_prefix/_de
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolacy committed Sep 20, 2021
1 parent 5bd8663 commit dba4c24
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions packages/storage-plus/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use crate::helpers::query_raw;
#[cfg(feature = "iterator")]
use crate::keys::Prefixer;
use crate::keys::PrimaryKey;
#[cfg(feature = "iterator")]
use crate::keys::{EmptyPrefix, Prefixer};
use crate::path::Path;
#[cfg(feature = "iterator")]
use crate::prefix::{Bound, Pair2, Prefix};
Expand Down Expand Up @@ -135,7 +133,6 @@ impl<'a, K, T> Map<'a, K, T>
where
T: Serialize + DeserializeOwned,
K: PrimaryKey<'a>,
K::NoPrefix: EmptyPrefix,
{
pub fn range<'c>(
&self,
Expand All @@ -147,8 +144,7 @@ where
where
T: 'c,
{
self.no_prefix(K::NoPrefix::new())
.range(store, min, max, order)
self.no_prefix().range(store, min, max, order)
}

pub fn keys<'c>(
Expand All @@ -161,8 +157,7 @@ where
where
T: 'c,
{
self.no_prefix(K::NoPrefix::new())
.keys(store, min, max, order)
self.no_prefix().keys(store, min, max, order)
}
}

Expand All @@ -172,7 +167,6 @@ impl<'a, K, T> Map<'a, K, T>
where
T: Serialize + DeserializeOwned,
K: PrimaryKey<'a> + Deserializable,
K::NoPrefix: EmptyPrefix,
{
pub fn range_de<'c>(
&self,
Expand All @@ -185,8 +179,7 @@ where
T: 'c,
K::Output: 'c,
{
self.no_prefix_de(K::NoPrefix::new())
.range_de(store, min, max, order)
self.no_prefix_de().range_de(store, min, max, order)
}

pub fn keys_de<'c>(
Expand All @@ -200,12 +193,11 @@ where
T: 'c,
K::Output: 'c,
{
self.no_prefix_de(K::NoPrefix::new())
.keys_de(store, min, max, order)
self.no_prefix_de().keys_de(store, min, max, order)
}

fn no_prefix_de(&self, p: K::NoPrefix) -> Prefix<T, K> {
Prefix::new(self.namespace, &p.prefix())
fn no_prefix_de(&self) -> Prefix<T, K> {
Prefix::new(self.namespace, &[])
}
}

Expand Down

0 comments on commit dba4c24

Please sign in to comment.