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
}
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
R: RangeBounds<Pubkey>,
{

View File

@ -129,11 +129,17 @@ impl<T: Clone + Copy + Debug> BucketMap<T> {
.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
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`
@ -404,7 +410,7 @@ mod tests {
for bin in 0..map.num_buckets() {
r.append(
&mut map
.range(bin, None::<&std::ops::RangeInclusive<Pubkey>>)
.items_in_range(bin, None::<&std::ops::RangeInclusive<Pubkey>>)
.unwrap_or_default(),
);
}