danlehmann / arbitrary-int

A modern and lightweight implementation of arbitrary integers for Rust
MIT License
31 stars 12 forks source link

Expand Number functionality (minor breaking change) #31

Open danlehmann opened 1 year ago

danlehmann commented 1 year ago

Number currently puts few restrictions on the underlying type:

pub trait Number: Sized {
    type UnderlyingType: Debug
        + From<u8>
        + TryFrom<u16>
        + TryFrom<u32>
        + TryFrom<u64>
        + TryFrom<u128>;
  ..
}

But maybe it should do more: Number could require that UnderlyingType supports Add, Sub etc so that it itself can do that, too. That would make it possible to calculate with Numbers.

dzmitry-lahoda commented 2 months ago

is it used anywhere? if not, no need.

and, e.g. one will impl log or pow, he can just restrict UT as needed in place.

so just suggestion to close item.