[go: up one dir, main page]

Today I Learned

tags


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:

See https://doc.rust-lang.org/reference/items/generics.html#const-generics See also https://blog.cocl2.com/posts/const-currying-rs/