const generics
Generics over a value, like an array's length, instead of a type.
A const generic parameter (const N: usize) makes an item generic over a compile-time constant, as in [T; N].
Examples
fn sum<const N: usize>(xs: [i32; N]) -> i32accepts both[1, 2]and[1, 2, 3], withNinferred as 2 and 3.
See also