forked from mirrors/jj
revset: simplify type constraints on combination iterators
Just a minor cleanup to remove lifetime parameter from the types. I tried to reimplement them by using itertools, but I couldn't find a simple way to encode short-circuiting at the end of either left or right iterator.
This commit is contained in:
parent
6d59156858
commit
4d91e4c196
1 changed files with 15 additions and 21 deletions
|
@ -404,17 +404,15 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UnionRevsetIterator<
|
struct UnionRevsetIterator<I1: Iterator, I2: Iterator> {
|
||||||
'index,
|
|
||||||
I1: Iterator<Item = IndexEntry<'index>>,
|
|
||||||
I2: Iterator<Item = IndexEntry<'index>>,
|
|
||||||
> {
|
|
||||||
iter1: Peekable<I1>,
|
iter1: Peekable<I1>,
|
||||||
iter2: Peekable<I2>,
|
iter2: Peekable<I2>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'index, I1: Iterator<Item = IndexEntry<'index>>, I2: Iterator<Item = IndexEntry<'index>>>
|
impl<'index, I1, I2> Iterator for UnionRevsetIterator<I1, I2>
|
||||||
Iterator for UnionRevsetIterator<'index, I1, I2>
|
where
|
||||||
|
I1: Iterator<Item = IndexEntry<'index>>,
|
||||||
|
I2: Iterator<Item = IndexEntry<'index>>,
|
||||||
{
|
{
|
||||||
type Item = IndexEntry<'index>;
|
type Item = IndexEntry<'index>;
|
||||||
|
|
||||||
|
@ -478,17 +476,15 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IntersectionRevsetIterator<
|
struct IntersectionRevsetIterator<I1: Iterator, I2: Iterator> {
|
||||||
'index,
|
|
||||||
I1: Iterator<Item = IndexEntry<'index>>,
|
|
||||||
I2: Iterator<Item = IndexEntry<'index>>,
|
|
||||||
> {
|
|
||||||
iter1: Peekable<I1>,
|
iter1: Peekable<I1>,
|
||||||
iter2: Peekable<I2>,
|
iter2: Peekable<I2>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'index, I1: Iterator<Item = IndexEntry<'index>>, I2: Iterator<Item = IndexEntry<'index>>>
|
impl<'index, I1, I2> Iterator for IntersectionRevsetIterator<I1, I2>
|
||||||
Iterator for IntersectionRevsetIterator<'index, I1, I2>
|
where
|
||||||
|
I1: Iterator<Item = IndexEntry<'index>>,
|
||||||
|
I2: Iterator<Item = IndexEntry<'index>>,
|
||||||
{
|
{
|
||||||
type Item = IndexEntry<'index>;
|
type Item = IndexEntry<'index>;
|
||||||
|
|
||||||
|
@ -564,17 +560,15 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DifferenceRevsetIterator<
|
struct DifferenceRevsetIterator<I1: Iterator, I2: Iterator> {
|
||||||
'index,
|
|
||||||
I1: Iterator<Item = IndexEntry<'index>>,
|
|
||||||
I2: Iterator<Item = IndexEntry<'index>>,
|
|
||||||
> {
|
|
||||||
iter1: Peekable<I1>,
|
iter1: Peekable<I1>,
|
||||||
iter2: Peekable<I2>,
|
iter2: Peekable<I2>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'index, I1: Iterator<Item = IndexEntry<'index>>, I2: Iterator<Item = IndexEntry<'index>>>
|
impl<'index, I1, I2> Iterator for DifferenceRevsetIterator<I1, I2>
|
||||||
Iterator for DifferenceRevsetIterator<'index, I1, I2>
|
where
|
||||||
|
I1: Iterator<Item = IndexEntry<'index>>,
|
||||||
|
I2: Iterator<Item = IndexEntry<'index>>,
|
||||||
{
|
{
|
||||||
type Item = IndexEntry<'index>;
|
type Item = IndexEntry<'index>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue