Move fn permute beneath fn choose
This commit is contained in:
parent
81c183dbcc
commit
661e6bc1b2
1 changed files with 8 additions and 8 deletions
16
src/lib.rs
16
src/lib.rs
|
@ -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>>,
|
||||
|
|
Loading…
Reference in a new issue