Closed lskyum closed 11 months ago
num-traits is an optional dependency of dashu-ratio. If you enable num-traits in Cargo.toml, then the traits should be supported.
@cmpute Oh, that's clever, it works fine!
I'm loving Rust more and more each day :-)
Thanks again
For anyone that ends up here, just do this in Cargo.toml
[dependencies]
dashu = { version = "x.x.x", features = ["num-traits"] }
I'm trying to use dashu's Rational for some geometric calculations. So dashu::Rational should be a a scalar in a Vector struct, but here it would be helpfull if it implemented num::Zero, num::One ect.
When trying to add the implementation myself, the Rust compiler complains: 'only traits defined in the current crate can be implemented for types defined outside of the crate'
This is the code i'm trying to make work:
Sorry if it's obvious, but I'm still new to Rust...