Open tcharding opened 3 years ago
I have the same issue, but with the num-traits
crate. Are we supposed to manually add num-traits
as a dependency to our crate?
I think the better solution for those that don't actually care about the traits is to add corresponding inherent methods, even though that's more tedious to implement methods in two places.
I think the better solution for those that don't actually care about the traits is to add corresponding inherent methods, even though that's more tedious to implement methods in two places.
I personally want to use methods like is_zero
or is_one
on big integers. I don't really care where the method is implemented, and I don't really care about use
ing stuff. However, I don't like that I have to explicitly add the num-traits
crate as a dependency because I don't use it for anything else. So now I have to make sure the num-traits
version stays compatible with the num-bigint
version.
For what it's worth, I'm quite new to Rust and I was very surprised I had to explicitly add an extra dependency just for basic methods like is_zero
or is_one
to work. I did not expect this from the number one "bignum" Rust crate, but maybe I'm missing something.
For users of this library to use
div_rem
they must add thenum-integer
dependency to their project. It would be more ergonomic ifnum-bigint
re-exported this trait so users could useuse num_bigint::{BigInt, Integer};
instead.