rename to items_in_range

This commit is contained in:
Brooks Prumo
2021-09-16 15:15:13 -05:00
committed by Jeff Washington (jwash)
parent 1649394231
commit c43c90665e
2 changed files with 10 additions and 4 deletions

View File

@ -65,7 +65,7 @@ impl<T: Clone + Copy> Bucket<T> {
rv rv
} }
pub fn range<R>(&self, range: Option<&R>) -> Vec<BucketItem<T>> pub fn items_in_range<R>(&self, range: Option<&R>) -> Vec<BucketItem<T>>
where where
R: RangeBounds<Pubkey>, R: RangeBounds<Pubkey>,
{ {

View File

@ -129,11 +129,17 @@ impl<T: Clone + Copy + Debug> BucketMap<T> {
.unwrap_or_default() .unwrap_or_default()
} }
pub fn range<R>(&self, ix: usize, range: Option<&R>) -> Option<Vec<BucketItem<T>>> pub fn items_in_range<R>(&self, ix: usize, range: Option<&R>) -> Option<Vec<BucketItem<T>>>
where where
R: RangeBounds<Pubkey>, R: RangeBounds<Pubkey>,
{ {
Some(self.buckets[ix].read().unwrap().as_ref()?.range(range)) Some(
self.buckets[ix]
.read()
.unwrap()
.as_ref()?
.items_in_range(range),
)
} }
/// Get the Pubkeys for bucket `ix` /// Get the Pubkeys for bucket `ix`
@ -404,7 +410,7 @@ mod tests {
for bin in 0..map.num_buckets() { for bin in 0..map.num_buckets() {
r.append( r.append(
&mut map &mut map
.range(bin, None::<&std::ops::RangeInclusive<Pubkey>>) .items_in_range(bin, None::<&std::ops::RangeInclusive<Pubkey>>)
.unwrap_or_default(), .unwrap_or_default(),
); );
} }