Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl traits from num-traits for UInt #42

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vxpm
Copy link

@vxpm vxpm commented Apr 4, 2024

also adds a new trait PrimNumber which has an extra trait bound of num_traits::PrimInt for both the trait itself and the UnderlyingType nevermind, not a good idea. the trait implementations are enough

Copy link
Owner

@danlehmann danlehmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, sorry I've been so slow to getting to this.

First of all: Thank you for your contribution!

This patch needs tests that actually exercise the new functionality.

I think, some things won't actually compile

                fn to_i64(&self) -> Option<i64> {
                    self.value().try_into().ok()
                }

My guess is that this will fail in the try_into() if the underlying type is u128. So we'd need tests for both u10 and u100.

@dzmitry-lahoda
Copy link
Contributor

dzmitry-lahoda commented Jul 2, 2024

@vxpm would you have time to recheck this ? thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants