paholg / typenum

Compile time numbers in Rust.
https://crates.io/crates/typenum
Other
518 stars 46 forks source link

[feature-request] Adding a `const` field to `ToInt` #178

Closed winestone closed 1 year ago

winestone commented 2 years ago

Hi, would there be any interest/objections for adding a const field to ToInt? Roughly something like this:

 pub trait ToInt<T> {
     fn to_int() -> T;
+    const INT_VALUE: T;
 }

This would allow the trait to be used in a const fn context.

I'm happy to make the change along with any testing/documentation/etc wanted.

paholg commented 2 years ago

I have no objections.