use crate::{
kmer::{KmerEncoder, encoders::three_bit::ThreeBitKmerEncoder},
math::Uint,
};
use std::marker::PhantomData;
pub struct KmerLen<const MAX_LEN: usize, E: KmerEncoder<MAX_LEN>>(PhantomData<E>);
pub trait SupportedKmerLen {
type T: Uint;
}
macro_rules! impl_supported_kmer_len {
($encoder:ident, $($max:expr => $type:ty),*) => {
$(
impl SupportedKmerLen for KmerLen<$max, $encoder<$max>> {
type T = $type;
}
)*
}
}
impl_supported_kmer_len! {
ThreeBitKmerEncoder,
2 => u8,
3 => u16,
4 => u16,
5 => u16,
6 => u32,
7 => u32,
8 => u32,
9 => u32,
10 => u32,
11 => u64,
12 => u64,
13 => u64,
14 => u64,
15 => u64,
16 => u64,
17 => u64,
18 => u64,
19 => u64,
20 => u64,
21 => u64,
22 => u128,
23 => u128,
24 => u128,
25 => u128,
26 => u128,
27 => u128,
28 => u128,
29 => u128,
30 => u128,
31 => u128,
32 => u128,
33 => u128,
34 => u128,
35 => u128,
36 => u128,
37 => u128,
38 => u128,
39 => u128,
40 => u128,
41 => u128,
42 => u128
}
pub(crate) type MaxLenToType<const MAX_LEN: usize, E> = <KmerLen<MAX_LEN, E> as SupportedKmerLen>::T;