Description
That would be convenient - I'd like to be able to pass a std::num::Wrapping<T>
to anything that accepts a Num
type.
Part of the discussion on #175 went over this, so I'd like to share my current use case for such a thing :
I've experimented with a custom "marker" trait named Deterministic
which is implemented on types on which basic operations are guaranteed to be consistent across platforms, build settings, etc.
std::num::Wrapping<T>
implementsDeterministic
;- fixed-point numbers are good candidates;
- primitive integer types aren't, because they might cause panics when they overflow;
- floating-point number types certainly aren't.
With this, I'd like to write functions which only accept types that are both Num
and Deterministic
(for some kind of reproducible game state data), and I can't pass Wrapping<T>
s on them - the only workarounds are either to redefine my own Wrapping type and have it implement Num, or define my own Num trait and... well, in short, nothing very appealing.
This "problem" is easy to solve from within this crate, but it seems more like a matter of agreeing on what the Num
trait actually means. As far as I'm concerned, this crate should make Wrapping<T>
implement Num
.
Thoughts ?