rust-num / num-bigint

Big integer types for Rust
Apache License 2.0
538 stars 187 forks source link

Re-export num-integer traits #190

Open tcharding opened 3 years ago

tcharding commented 3 years ago

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.

jvdsn commented 2 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?

cuviper commented 2 years ago

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.

jvdsn commented 2 years ago

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.