-
Notifications
You must be signed in to change notification settings - Fork 149
Shouldn't Num be also implemented for std::num::Wrapping<T> ? #278
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
Comments
It still feels a little weird to me for |
Yup! See #279. |
Implemented Zero, One and Num for std::num::Wrapping<T> Attempts to fix issue #278
Fixed by #279. |
Extend the Error API with line, column, category
That would be convenient - I'd like to be able to pass a
std::num::Wrapping<T>
to anything that accepts aNum
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
;With this, I'd like to write functions which only accept types that are both
Num
andDeterministic
(for some kind of reproducible game state data), and I can't passWrapping<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 makeWrapping<T>
implementNum
.Thoughts ?
The text was updated successfully, but these errors were encountered: