@@ -3,11 +3,11 @@ use alloc::vec::Vec;
3
3
use std:: fmt;
4
4
use std:: iter:: FusedIterator ;
5
5
6
- use super :: lazy_buffer:: { LazyBuffer , MaybeConstUsize as _, PoolIndex } ;
6
+ use super :: lazy_buffer:: { ArrayOrVecHelper , LazyBuffer , MaybeConstUsize as _} ;
7
7
use crate :: size_hint:: { self , SizeHint } ;
8
8
9
9
#[ must_use = "iterator adaptors are lazy and do nothing unless consumed" ]
10
- pub struct PermutationsGeneric < I : Iterator , Idx : PoolIndex > {
10
+ pub struct PermutationsGeneric < I : Iterator , Idx : ArrayOrVecHelper > {
11
11
vals : LazyBuffer < I > ,
12
12
state : PermutationState < Idx > ,
13
13
}
@@ -23,13 +23,13 @@ impl<I, Idx> Clone for PermutationsGeneric<I, Idx>
23
23
where
24
24
I : Clone + Iterator ,
25
25
I :: Item : Clone ,
26
- Idx : Clone + PoolIndex ,
26
+ Idx : Clone + ArrayOrVecHelper ,
27
27
{
28
28
clone_fields ! ( vals, state) ;
29
29
}
30
30
31
31
#[ derive( Clone , Debug ) ]
32
- enum PermutationState < Idx : PoolIndex > {
32
+ enum PermutationState < Idx : ArrayOrVecHelper > {
33
33
/// No permutation generated yet.
34
34
Start { k : Idx :: Length } ,
35
35
/// Values from the iterator are not fully loaded yet so `n` is still unknown.
@@ -44,7 +44,7 @@ enum PermutationState<Idx: PoolIndex> {
44
44
End ,
45
45
}
46
46
47
- impl < I , Idx : PoolIndex > fmt:: Debug for PermutationsGeneric < I , Idx >
47
+ impl < I , Idx : ArrayOrVecHelper > fmt:: Debug for PermutationsGeneric < I , Idx >
48
48
where
49
49
I : Iterator + fmt:: Debug ,
50
50
I :: Item : fmt:: Debug ,
@@ -60,7 +60,7 @@ pub fn permutations<I: Iterator>(iter: I, k: usize) -> Permutations<I> {
60
60
}
61
61
}
62
62
63
- impl < I , Idx : PoolIndex > Iterator for PermutationsGeneric < I , Idx >
63
+ impl < I , Idx : ArrayOrVecHelper > Iterator for PermutationsGeneric < I , Idx >
64
64
where
65
65
I : Iterator ,
66
66
I :: Item : Clone ,
@@ -140,7 +140,7 @@ where
140
140
}
141
141
}
142
142
143
- impl < I , Idx : PoolIndex > FusedIterator for PermutationsGeneric < I , Idx >
143
+ impl < I , Idx : ArrayOrVecHelper > FusedIterator for PermutationsGeneric < I , Idx >
144
144
where
145
145
I : Iterator ,
146
146
I :: Item : Clone ,
@@ -165,7 +165,7 @@ fn advance(indices: &mut [usize], cycles: &mut [usize]) -> bool {
165
165
true
166
166
}
167
167
168
- impl < Idx : PoolIndex > PermutationState < Idx > {
168
+ impl < Idx : ArrayOrVecHelper > PermutationState < Idx > {
169
169
fn size_hint_for ( & self , n : usize ) -> SizeHint {
170
170
// At the beginning, there are `n!/(n-k)!` items to come.
171
171
let at_start = |n, k : Idx :: Length | {
0 commit comments