Robbepop / apint

Arbitrary precision integers library.
Other
27 stars 4 forks source link

Use From trait for constructing from primitive integer types #2

Closed brendanzab closed 6 years ago

brendanzab commented 6 years ago

It would probably be more idiomatic (and useful) to have From<u8>, From<u16>, ... etc. impls than separate constructor methods.

Robbepop commented 6 years ago

I thought about this, too. However, I didn't come to a pleasant solution until now since I liked the expliciteness in the from_uN and from_iN forms very much. I must admit that using the From<T> trait is more idiomatic and will add them, too. Keep in mind that this library is still very far from completion, many things will change so maybe the new From<T> impls will entirely replace the explicit constructors in the end. The library and its API is still under heavy development.

Robbepop commented 6 years ago

Done (https://github.com/Robbepop/apint/commit/6cea2a45a9d64deda49f94241ef48987fdda0849) & closed.

Thank you for this suggestion! :)