@@ -3,11 +3,11 @@ use alloc::vec::Vec;
33use std:: fmt;
44use std:: iter:: FusedIterator ;
55
6- use super :: lazy_buffer:: { LazyBuffer , MaybeConstUsize as _, PoolIndex } ;
6+ use super :: lazy_buffer:: { ArrayOrVecHelper , LazyBuffer , MaybeConstUsize as _} ;
77use crate :: size_hint:: { self , SizeHint } ;
88
99#[ 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 > {
1111 vals : LazyBuffer < I > ,
1212 state : PermutationState < Idx > ,
1313}
@@ -23,13 +23,13 @@ impl<I, Idx> Clone for PermutationsGeneric<I, Idx>
2323where
2424 I : Clone + Iterator ,
2525 I :: Item : Clone ,
26- Idx : Clone + PoolIndex ,
26+ Idx : Clone + ArrayOrVecHelper ,
2727{
2828 clone_fields ! ( vals, state) ;
2929}
3030
3131#[ derive( Clone , Debug ) ]
32- enum PermutationState < Idx : PoolIndex > {
32+ enum PermutationState < Idx : ArrayOrVecHelper > {
3333 /// No permutation generated yet.
3434 Start { k : Idx :: Length } ,
3535 /// Values from the iterator are not fully loaded yet so `n` is still unknown.
@@ -44,7 +44,7 @@ enum PermutationState<Idx: PoolIndex> {
4444 End ,
4545}
4646
47- impl < I , Idx : PoolIndex > fmt:: Debug for PermutationsGeneric < I , Idx >
47+ impl < I , Idx : ArrayOrVecHelper > fmt:: Debug for PermutationsGeneric < I , Idx >
4848where
4949 I : Iterator + fmt:: Debug ,
5050 I :: Item : fmt:: Debug ,
@@ -60,7 +60,7 @@ pub fn permutations<I: Iterator>(iter: I, k: usize) -> Permutations<I> {
6060 }
6161}
6262
63- impl < I , Idx : PoolIndex > Iterator for PermutationsGeneric < I , Idx >
63+ impl < I , Idx : ArrayOrVecHelper > Iterator for PermutationsGeneric < I , Idx >
6464where
6565 I : Iterator ,
6666 I :: Item : Clone ,
@@ -140,7 +140,7 @@ where
140140 }
141141}
142142
143- impl < I , Idx : PoolIndex > FusedIterator for PermutationsGeneric < I , Idx >
143+ impl < I , Idx : ArrayOrVecHelper > FusedIterator for PermutationsGeneric < I , Idx >
144144where
145145 I : Iterator ,
146146 I :: Item : Clone ,
@@ -165,7 +165,7 @@ fn advance(indices: &mut [usize], cycles: &mut [usize]) -> bool {
165165 true
166166}
167167
168- impl < Idx : PoolIndex > PermutationState < Idx > {
168+ impl < Idx : ArrayOrVecHelper > PermutationState < Idx > {
169169 fn size_hint_for ( & self , n : usize ) -> SizeHint {
170170 // At the beginning, there are `n!/(n-k)!` items to come.
171171 let at_start = |n, k : Idx :: Length | {
0 commit comments