diff --git a/lib/src/default_index/revset_engine.rs b/lib/src/default_index/revset_engine.rs index 9f369f288e..496fb8dbd4 100644 --- a/lib/src/default_index/revset_engine.rs +++ b/lib/src/default_index/revset_engine.rs @@ -57,7 +57,7 @@ impl ToPredicateFn for Box { trait InternalRevset: fmt::Debug + ToPredicateFn { // All revsets currently iterate in order of descending index position - fn iter<'a, 'index: 'a>( + fn entries<'a, 'index: 'a>( &'a self, index: CompositeIndex<'index>, ) -> Box> + 'a>; @@ -73,11 +73,11 @@ trait InternalRevset: fmt::Debug + ToPredicateFn { } impl InternalRevset for Box { - fn iter<'a, 'index: 'a>( + fn entries<'a, 'index: 'a>( &'a self, index: CompositeIndex<'index>, ) -> Box> + 'a> { - ::iter(self, index) + ::entries(self, index) } fn positions<'a, 'index: 'a>( @@ -106,7 +106,7 @@ impl RevsetImpl { } fn entries(&self) -> Box> + '_> { - self.inner.iter(self.index.as_composite()) + self.inner.entries(self.index.as_composite()) } fn positions(&self) -> Box + '_> { @@ -178,7 +178,7 @@ impl EagerRevset { } impl InternalRevset for EagerRevset { - fn iter<'a, 'index: 'a>( + fn entries<'a, 'index: 'a>( &'a self, index: CompositeIndex<'index>, ) -> Box> + 'a> { @@ -246,7 +246,7 @@ impl InternalRevset for RevWalkRevset where F: Fn(CompositeIndex<'_>) -> Box> + '_>, { - fn iter<'a, 'index: 'a>( + fn entries<'a, 'index: 'a>( &'a self, index: CompositeIndex<'index>, ) -> Box> + 'a> { @@ -257,7 +257,7 @@ where &'a self, index: CompositeIndex<'index>, ) -> Box + 'a> { - Box::new(self.iter(index).map(|entry| entry.position())) + Box::new(self.entries(index).map(|entry| entry.position())) } fn into_predicate<'a>(self: Box) -> Box @@ -276,7 +276,7 @@ where &'a self, index: CompositeIndex<'index>, ) -> Box) -> bool + 'a> { - predicate_fn_from_entries(self.iter(index)) + predicate_fn_from_entries(self.entries(index)) } } @@ -309,19 +309,19 @@ where S: InternalRevset, P: ToPredicateFn, { - fn iter<'a, 'index: 'a>( + fn entries<'a, 'index: 'a>( &'a self, index: CompositeIndex<'index>, ) -> Box> + 'a> { let p = self.predicate.to_predicate_fn(index); - Box::new(self.candidates.iter(index).filter(p)) + Box::new(self.candidates.entries(index).filter(p)) } fn positions<'a, 'index: 'a>( &'a self, index: CompositeIndex<'index>, ) -> Box + 'a> { - Box::new(self.iter(index).map(|entry| entry.position())) + Box::new(self.entries(index).map(|entry| entry.position())) } fn into_predicate<'a>(self: Box) -> Box @@ -371,13 +371,13 @@ where S1: InternalRevset, S2: InternalRevset, { - fn iter<'a, 'index: 'a>( + fn entries<'a, 'index: 'a>( &'a self, index: CompositeIndex<'index>, ) -> Box> + 'a> { Box::new(union_by( - self.set1.iter(index), - self.set2.iter(index), + self.set1.entries(index), + self.set2.entries(index), |entry1, entry2| entry1.position().cmp(&entry2.position()).reverse(), )) } @@ -475,12 +475,12 @@ where S1: InternalRevset, S2: InternalRevset, { - fn iter<'a, 'index: 'a>( + fn entries<'a, 'index: 'a>( &'a self, index: CompositeIndex<'index>, ) -> Box> + 'a> { Box::new(intersection_by( - self.set1.iter(index), + self.set1.entries(index), self.set2.positions(index), |entry1, pos2| entry1.position().cmp(pos2).reverse(), )) @@ -591,12 +591,12 @@ where S1: InternalRevset, S2: InternalRevset, { - fn iter<'a, 'index: 'a>( + fn entries<'a, 'index: 'a>( &'a self, index: CompositeIndex<'index>, ) -> Box> + 'a> { Box::new(difference_by( - self.set1.iter(index), + self.set1.entries(index), self.set2.positions(index), |entry1, pos2| entry1.position().cmp(pos2).reverse(), )) @@ -837,7 +837,7 @@ impl<'index> EvaluationContext<'index> { Ok(Box::new(EagerRevset { positions })) } ResolvedExpression::Roots(candidates) => { - let candidate_entries = self.evaluate(candidates)?.iter(index).collect_vec(); + let candidate_entries = self.evaluate(candidates)?.entries(index).collect_vec(); let candidate_positions = candidate_entries .iter() .map(|entry| entry.position()) @@ -944,7 +944,7 @@ impl<'index> EvaluationContext<'index> { // Maintain min-heap containing the latest (greatest) count items. For small // count and large candidate set, this is probably cheaper than building vec // and applying selection algorithm. - let mut candidate_iter = candidate_set.iter(self.index).map(make_rev_item).fuse(); + let mut candidate_iter = candidate_set.entries(self.index).map(make_rev_item).fuse(); let mut latest_items = BinaryHeap::from_iter(candidate_iter.by_ref().take(count)); for item in candidate_iter { let mut earliest = latest_items.peek_mut().unwrap(); @@ -1127,7 +1127,7 @@ mod tests { predicate: as_pure_predicate_fn(|_index, entry| entry.commit_id() != id_4), }; assert_eq!( - set.iter(index.as_composite()).collect_vec(), + set.entries(index.as_composite()).collect_vec(), make_entries(&[&id_2, &id_0]) ); assert_eq!( @@ -1147,7 +1147,7 @@ mod tests { predicate: make_set(&[&id_3, &id_2, &id_1]), }; assert_eq!( - set.iter(index.as_composite()).collect_vec(), + set.entries(index.as_composite()).collect_vec(), make_entries(&[&id_2]) ); assert_eq!( @@ -1166,7 +1166,7 @@ mod tests { set2: make_set(&[&id_3, &id_2, &id_1]), }; assert_eq!( - set.iter(index.as_composite()).collect_vec(), + set.entries(index.as_composite()).collect_vec(), make_entries(&[&id_4, &id_3, &id_2, &id_1]) ); assert_eq!( @@ -1185,7 +1185,7 @@ mod tests { set2: make_set(&[&id_3, &id_2, &id_1]), }; assert_eq!( - set.iter(index.as_composite()).collect_vec(), + set.entries(index.as_composite()).collect_vec(), make_entries(&[&id_2]) ); assert_eq!( @@ -1204,7 +1204,7 @@ mod tests { set2: make_set(&[&id_3, &id_2, &id_1]), }; assert_eq!( - set.iter(index.as_composite()).collect_vec(), + set.entries(index.as_composite()).collect_vec(), make_entries(&[&id_4, &id_0]) ); assert_eq!(