-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement num-traits. #19
Comments
Thanks for bringing this to attention. My main concern is that I know there was a lot of numeric traits in Maybe it would be valuable to expose such interface in an unstable nightly-only feature? |
My understanding is that num-traits, like the rest of the num family of crates was fairly stable. That said, I would understand completely if you would rather have it be locked behind a feature flag. |
Since the types from this crate are analog to types from the As I said, I would be happy to include implementation of these types behind some sort of nightly only unstable feature flag (that won't block the release of |
I currently have it behind a feature gate. One question I'd like to ask is whether or not you'd prefer to have trait impls for things like num-traits and serde in their own files, or if it would be fine to put them alongside the existing implementations. Right now, I have what I can write inline with the base implementations. That said, due to #11, I can only implement 6 of the traits, 3 of which already have corresponding stable functions, another is |
Great, just remember that (in Rust spirit) this unstable feature should be nightly only.
I think it would be fine to keep them in
Which traits would have to be implemented for a full implementation?
|
Given that the num crates don't require nightly makes me reluctant to allow their traits only on nightly. As for which traits are necessary, almost all of them. A few like |
Since you're worried about stability, I will mention that the
|
|
In addition to the various traits in std, implementing the traits from num-traits would enable writing algorithms and data structures that are polymorphic on the the number of bits. While any of them would be useful,
PrimInt
would be incredibly useful, but it has a very large number of dependencies and has methods that don't make a huge amount of sense for integers with a bit-width that isn't a multiple of a byte, namely{to,from}_{be,le}
andswap_bytes
.As most of the traits depend on operator traits in the standard library, this is blocked by #11.
The text was updated successfully, but these errors were encountered: