Move fn permute beneath fn choose

This commit is contained in:
asonix 2024-05-26 13:43:04 -05:00
parent 81c183dbcc
commit 661e6bc1b2

View file

@ -7,14 +7,6 @@ pub fn choose_permute<T: Clone, const SIZE: usize>(
}
}
pub fn permute<T: Clone, const SIZE: usize>(source: [T; SIZE]) -> Permute<T, SIZE> {
Permute {
source,
count: [0; SIZE],
closed: false,
}
}
pub fn choose<T: Clone, const SIZE: usize>(source: &[T]) -> Choose<'_, T, SIZE> {
if source.len() < SIZE {
panic!("Source to small to choose {SIZE} elements");
@ -27,6 +19,14 @@ pub fn choose<T: Clone, const SIZE: usize>(source: &[T]) -> Choose<'_, T, SIZE>
}
}
pub fn permute<T: Clone, const SIZE: usize>(source: [T; SIZE]) -> Permute<T, SIZE> {
Permute {
source,
count: [0; SIZE],
closed: false,
}
}
pub struct ChoosePermute<'a, T, const SIZE: usize> {
choose: Choose<'a, T, SIZE>,
permute: Option<Permute<T, SIZE>>,