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

some set of generic based non zero support #346

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dzmitry-lahoda
Copy link

@dzmitry-lahoda dzmitry-lahoda commented Jan 31, 2025

TLDR;

  • need new release bump
  • saturating sub works only for self minus self outputs self and requires sub, which is not the case generally
  • etc

LONG:

Covers what can work for current stable non zero.

What can be done?

  1. detect Rust/MSRV lang version and gate NonZero<T> since it was introduced. Easy, dtolnay doing that.
  2. detect this crate version major bump, and change base traits relations. So we do not need Add/Mul on non zeros. add VERSION_NUMBER_UNSTABLE feature like. So as for now just add new base traits.
  3. One. Seems reasonable to add, but it tells some MATH props on interface, I can reproduce it without need to Mul, with Checked only.
  4. Port tests and some cast support from Implement Bounded, ToPrimitive, NumCast, FromPrimitive for NonZero* #334 .Differs from Implement Bounded, ToPrimitive, NumCast, FromPrimitive for NonZero* #334 by using generics.

I can do any version detection (Package/Rust) so can ensure it switched automatically.

Partially overlaps with next, but not same:

#85

#215

@dzmitry-lahoda dzmitry-lahoda marked this pull request as draft January 31, 2025 23:04
@dzmitry-lahoda dzmitry-lahoda changed the title some set of non zero support some set of generic based non zero support Jan 31, 2025
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.

1 participant