How to use const generics

Use const generics by adding a const parameter to types or functions to enable compile-time specialization for fixed sizes.

Use const generics by adding a const parameter with a type (usually usize) to your struct, enum, or function definition, then pass a compile-time constant as the argument. This allows the compiler to generate specialized code for different sizes or values at compile time.

struct Array<const N: usize> {
    data: [i32; N],
}

fn main() {
    let arr = Array { data: [0; 10] };
}