How to make a const parameter generic?
⚓ Rust 📅 2026-02-19 👤 surdeus 👁️ 1I have this code
struct Min<T, const N: usize>(T, PhantomData<usize>);
But N isn't always a usize. I tried passing N: T to make N could accept any numeric type like this, but it didn't work
struct Min<T, const N: T>(T, PhantomData<T>);
Is there a way to do this?
3 posts - 3 participants
🏷️ Rust_feed