Skip to content

Commit

Permalink
Add keys() shortcut for simple keys to MultiIndex / UniqueIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolacy committed Jul 22, 2021
1 parent acd2c93 commit 5325f00
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/storage-plus/src/indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,17 @@ where
self.sub_prefix(K::SubPrefix::new())
.range(store, min, max, order)
}

pub fn keys<'c>(
&'c self,
store: &'c dyn Storage,
min: Option<Bound>,
max: Option<Bound>,
order: Order,
) -> Box<dyn Iterator<Item = Vec<u8>> + 'c> {
self.sub_prefix(K::SubPrefix::new())
.keys(store, min, max, order)
}
}

#[derive(Deserialize, Serialize)]
Expand Down Expand Up @@ -300,4 +311,15 @@ where
self.sub_prefix(K::SubPrefix::new())
.range(store, min, max, order)
}

pub fn keys<'c>(
&self,
store: &'c dyn Storage,
min: Option<Bound>,
max: Option<Bound>,
order: Order,
) -> Box<dyn Iterator<Item = StdResult<Vec<u8>>> + 'c> {
self.sub_prefix(K::SubPrefix::new())
.keys(store, min, max, order)
}
}

0 comments on commit 5325f00

Please sign in to comment.