-
Notifications
You must be signed in to change notification settings - Fork 99
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
How to get Ord and Eq with f64 underlying storage type? #208
Comments
are not applicable as they would change the dimension. (Have a look at I suppose the easiest way for you to combine these is to create a newtype wrapper, e.g.
which corresponds roughly to
|
Understood. Thank you for your quick response, this is very helpful! |
Thanks for the quick response @adamreichold! Similar to how the standard library doesn't impl Any other questions, @nanowizard, or are we OK to close this issue? |
@iliekturtles I agree its somewhat out of scope for |
|
Re-opening to investigate supporting |
For some code I am writing I needed the ordered units. I initially wrote some wrappers around the quantity I use most to be able to use that totally ordered. But then found |
Please bear with me, I'm still getting familiar with Rust. I'd really like to use this library to handle unit conversions but I ran into an issue with my need to have a sorted
BTreeMap
ofTime
keys.This gave me the following error:
This makes sense because
Ord
isn't implemented for native float types, andOrd
is necessary for keeping things sorted in theBTreeMap
. So I reached for a wrapper which would take care of that. The ordered-float crate looked like a popular choice so I went with that.That gives me a new error:
Now, this error I don't quite understand. Apparently the
Float
trait is not satisfied even though the underlying type isf64
? Why would that be?Do you have any suggestions for allowing these types to be used with sorted collections such as
BTreeMap
?The text was updated successfully, but these errors were encountered: