Skip to content

Commit 5003927

Browse files
phimuemueronnodas
authored andcommitted
PoolIndex<T> -> PoolIndex
1 parent 9b3d6e2 commit 5003927

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/combinations.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,24 @@ impl MaybeConstUsize for usize {
5858

5959
/// A type holding indices of elements in a pool or buffer of items from an inner iterator
6060
/// and used to pick out different combinations in a generic way.
61-
pub trait PoolIndex<T>: BorrowMut<[usize]> {
62-
type Item;
61+
pub trait PoolIndex: BorrowMut<[usize]> {
62+
type Item<T>;
6363
type Length: MaybeConstUsize;
6464

65-
fn extract_item<I: Iterator<Item = T>>(&self, pool: &LazyBuffer<I>) -> Self::Item
65+
fn extract_item<I: Iterator>(&self, pool: &LazyBuffer<I>) -> Self::Item<I::Item>
6666
where
67-
T: Clone;
67+
I::Item: Clone;
6868

6969
fn len(&self) -> Self::Length;
7070
}
7171

72-
impl<T> PoolIndex<T> for Vec<usize> {
73-
type Item = Vec<T>;
72+
impl PoolIndex for Vec<usize> {
73+
type Item<T> = Vec<T>;
7474
type Length = usize;
7575

76-
fn extract_item<I: Iterator<Item = T>>(&self, pool: &LazyBuffer<I>) -> Vec<T>
76+
fn extract_item<I: Iterator>(&self, pool: &LazyBuffer<I>) -> Self::Item<I::Item>
7777
where
78-
T: Clone,
78+
I::Item: Clone
7979
{
8080
pool.get_at(self)
8181
}
@@ -85,13 +85,13 @@ impl<T> PoolIndex<T> for Vec<usize> {
8585
}
8686
}
8787

88-
impl<T, const K: usize> PoolIndex<T> for [usize; K] {
89-
type Item = [T; K];
88+
impl<const K: usize> PoolIndex for [usize; K] {
89+
type Item<T> = [T; K];
9090
type Length = ConstUsize<K>;
9191

92-
fn extract_item<I: Iterator<Item = T>>(&self, pool: &LazyBuffer<I>) -> [T; K]
92+
fn extract_item<I: Iterator>(&self, pool: &LazyBuffer<I>) -> Self::Item<I::Item>
9393
where
94-
T: Clone,
94+
I::Item: Clone
9595
{
9696
pool.get_array(*self)
9797
}
@@ -119,7 +119,7 @@ where
119119
debug_fmt_fields!(Combinations, indices, pool, first);
120120
}
121121

122-
impl<I: Iterator, Idx: PoolIndex<I::Item>> CombinationsGeneric<I, Idx> {
122+
impl<I: Iterator, Idx: PoolIndex> CombinationsGeneric<I, Idx> {
123123
/// Constructor with arguments the inner iterator and the initial state for the indices.
124124
fn new(iter: I, indices: Idx) -> Self {
125125
Self {
@@ -236,9 +236,9 @@ impl<I, Idx> Iterator for CombinationsGeneric<I, Idx>
236236
where
237237
I: Iterator,
238238
I::Item: Clone,
239-
Idx: PoolIndex<I::Item>,
239+
Idx: PoolIndex,
240240
{
241-
type Item = Idx::Item;
241+
type Item = Idx::Item<I::Item>;
242242
fn next(&mut self) -> Option<Self::Item> {
243243
let done = if self.first {
244244
self.init()
@@ -274,7 +274,7 @@ impl<I, Idx> FusedIterator for CombinationsGeneric<I, Idx>
274274
where
275275
I: Iterator,
276276
I::Item: Clone,
277-
Idx: PoolIndex<I::Item>,
277+
Idx: PoolIndex,
278278
{
279279
}
280280

0 commit comments

Comments
 (0)