num-bigint icon indicating copy to clipboard operation
num-bigint copied to clipboard

Re-export num-integer traits

Open tcharding opened this issue 4 years ago • 3 comments
trafficstars

For users of this library to use div_rem they must add the num-integer dependency to their project. It would be more ergonomic if num-bigint re-exported this trait so users could use use num_bigint::{BigInt, Integer}; instead.

tcharding avatar Feb 04 '21 21:02 tcharding

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?

jvdsn avatar Feb 25 '22 20:02 jvdsn

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.

cuviper avatar Feb 25 '22 22:02 cuviper

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 useing 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.

jvdsn avatar Feb 25 '22 22:02 jvdsn