Open benmkw opened 4 years ago
As far as I can see, this does not include any new tests for the added functionality.
As far as I can see, this does not include any new tests for the added functionality.
Yes, I was unsure how much this should be tested, maybe a few lines which check the Ok and Error case would be fine because it does not really add anything, just exposes existing functionality differently.
I was using this as a fork and also needed the try_into
counterparts so I could add those as well if you think this would be a good direction.
as described in https://github.com/rust-num/num-rational/issues/85
I went ahead and implemented From and TryFrom for all applicable types, not just floats.
This is a more detailed approach than the current FromPrimitive Trait which always returns an Option but some conversions can never fail so we can unwrap them.