revset: add type parameters to remaining iterator adapters

This is another step towards removing `RevsetIterator`. These types
are private, so someone using the library can't accidentally create a
`UnionRevsetIterator` with inputs in different order, for example.
This commit is contained in:
Martin von Zweigbergk 2023-02-15 21:02:47 -08:00 committed by Martin von Zweigbergk
parent 44e6ef9bae
commit 91e56c7f2f

View file

@ -1769,12 +1769,18 @@ impl<'index> ToPredicateFn<'index> for UnionRevset<'index> {
} }
} }
struct UnionRevsetIterator<'revset, 'index> { struct UnionRevsetIterator<
iter1: Peekable<RevsetIterator<'revset, 'index>>, 'index,
iter2: Peekable<RevsetIterator<'revset, 'index>>, I1: Iterator<Item = IndexEntry<'index>>,
I2: Iterator<Item = IndexEntry<'index>>,
> {
iter1: Peekable<I1>,
iter2: Peekable<I2>,
} }
impl<'revset, 'index> Iterator for UnionRevsetIterator<'revset, 'index> { impl<'index, I1: Iterator<Item = IndexEntry<'index>>, I2: Iterator<Item = IndexEntry<'index>>>
Iterator for UnionRevsetIterator<'index, I1, I2>
{
type Item = IndexEntry<'index>; type Item = IndexEntry<'index>;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
@ -1815,12 +1821,18 @@ impl<'index> ToPredicateFn<'index> for IntersectionRevset<'index> {
} }
} }
struct IntersectionRevsetIterator<'revset, 'index> { struct IntersectionRevsetIterator<
iter1: Peekable<RevsetIterator<'revset, 'index>>, 'index,
iter2: Peekable<RevsetIterator<'revset, 'index>>, I1: Iterator<Item = IndexEntry<'index>>,
I2: Iterator<Item = IndexEntry<'index>>,
> {
iter1: Peekable<I1>,
iter2: Peekable<I2>,
} }
impl<'revset, 'index> Iterator for IntersectionRevsetIterator<'revset, 'index> { impl<'index, I1: Iterator<Item = IndexEntry<'index>>, I2: Iterator<Item = IndexEntry<'index>>>
Iterator for IntersectionRevsetIterator<'index, I1, I2>
{
type Item = IndexEntry<'index>; type Item = IndexEntry<'index>;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
@ -1874,12 +1886,18 @@ impl<'index> ToPredicateFn<'index> for DifferenceRevset<'index> {
} }
} }
struct DifferenceRevsetIterator<'revset, 'index> { struct DifferenceRevsetIterator<
iter1: Peekable<RevsetIterator<'revset, 'index>>, 'index,
iter2: Peekable<RevsetIterator<'revset, 'index>>, I1: Iterator<Item = IndexEntry<'index>>,
I2: Iterator<Item = IndexEntry<'index>>,
> {
iter1: Peekable<I1>,
iter2: Peekable<I2>,
} }
impl<'revset, 'index> Iterator for DifferenceRevsetIterator<'revset, 'index> { impl<'index, I1: Iterator<Item = IndexEntry<'index>>, I2: Iterator<Item = IndexEntry<'index>>>
Iterator for DifferenceRevsetIterator<'index, I1, I2>
{
type Item = IndexEntry<'index>; type Item = IndexEntry<'index>;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {