@@ -58,24 +58,24 @@ impl MaybeConstUsize for usize {
58
58
59
59
/// A type holding indices of elements in a pool or buffer of items from an inner iterator
60
60
/// 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 > ;
63
63
type Length : MaybeConstUsize ;
64
64
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 >
66
66
where
67
- T : Clone ;
67
+ I :: Item : Clone ;
68
68
69
69
fn len ( & self ) -> Self :: Length ;
70
70
}
71
71
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 > ;
74
74
type Length = usize ;
75
75
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 >
77
77
where
78
- T : Clone ,
78
+ I :: Item : Clone
79
79
{
80
80
pool. get_at ( self )
81
81
}
@@ -85,13 +85,13 @@ impl<T> PoolIndex<T> for Vec<usize> {
85
85
}
86
86
}
87
87
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 ] ;
90
90
type Length = ConstUsize < K > ;
91
91
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 >
93
93
where
94
- T : Clone ,
94
+ I :: Item : Clone
95
95
{
96
96
pool. get_array ( * self )
97
97
}
@@ -119,7 +119,7 @@ where
119
119
debug_fmt_fields ! ( Combinations , indices, pool, first) ;
120
120
}
121
121
122
- impl < I : Iterator , Idx : PoolIndex < I :: Item > > CombinationsGeneric < I , Idx > {
122
+ impl < I : Iterator , Idx : PoolIndex > CombinationsGeneric < I , Idx > {
123
123
/// Constructor with arguments the inner iterator and the initial state for the indices.
124
124
fn new ( iter : I , indices : Idx ) -> Self {
125
125
Self {
@@ -236,9 +236,9 @@ impl<I, Idx> Iterator for CombinationsGeneric<I, Idx>
236
236
where
237
237
I : Iterator ,
238
238
I :: Item : Clone ,
239
- Idx : PoolIndex < I :: Item > ,
239
+ Idx : PoolIndex ,
240
240
{
241
- type Item = Idx :: Item ;
241
+ type Item = Idx :: Item < I :: Item > ;
242
242
fn next ( & mut self ) -> Option < Self :: Item > {
243
243
let done = if self . first {
244
244
self . init ( )
@@ -274,7 +274,7 @@ impl<I, Idx> FusedIterator for CombinationsGeneric<I, Idx>
274
274
where
275
275
I : Iterator ,
276
276
I :: Item : Clone ,
277
- Idx : PoolIndex < I :: Item > ,
277
+ Idx : PoolIndex ,
278
278
{
279
279
}
280
280
0 commit comments