2024/04/13
That you can write
fn foo<const N: usize>(arr: &[u8; N]) {
todo!()
}
to specialize a function for different array sizes, etc. You can use the following types in const generics:
- u8, u16, u32, u64, u128, usize
- i8, i16, i32, i64, i128, isize
- char
- bool
See https://doc.rust-lang.org/reference/items/generics.html#const-generics See also https://blog.cocl2.com/posts/const-currying-rs/