Closed tarcieri closed 2 years ago
Both Unsigned
and Integer
traits have static methods and associated constants that give you "normal" numbers. I haven't played with const generics in a while, so I'm not sure if they work for that yet, but that would be the way.
https://docs.rs/typenum/1.12.0/typenum/marker_traits/trait.Unsigned.html
Example:
use typenum::{Unsigned, U27};
const num: u64 = U27::U64;
Seems like what I had in mind isn't possible with min_const_generics
, unfortunately
Perhaps this is already possible today, but I'd be curious to know (and I assume others would too):
If we have code that leverages typenum today which we would like to slowly transition to const generics (particularly across crate boundaries), is there a way to do so?
That is to say, is it possible to go from typenum types like
U0
,U1
, etc to const generic parameters? Do the existing methods defined on traits likeUnsigned
make this possible?