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

Add ConstZero and ConstOne traits #303

Merged
merged 6 commits into from
Feb 8, 2024
Merged

Commits on Feb 8, 2024

  1. Add ZeroConstant and OneConstant traits

    Adds traits which are alternatives to the more dynamic `Zero`/`One`
    traits which are useful for stack-allocated types where it's possible to
    define constant values for zero/one.
    
    `ZeroConstant` bounds on `Zero` as a supertrait, and `OneConstant` on
    `One`, allowing them to be used as drop-in replacements.
    
    When a type also impls `PartialEq`, then `ZeroConstant` also provides a
    blanket impl of `Zero`, and likewise for `OneConstant`/`One`, making
    it simple for stack-allocated integers to impl these traits as an
    alternative to `Zero`/`One` while still remaining fully compatible.
    
    The internal impls of `Zero`/`One` on the numeric primitive types have
    been changed to use these traits, which should be a fully
    backwards-compatible change.
    tarcieri authored and cuviper committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    06c0ee0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    536dcf2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bc42b83 View commit details
    Browse the repository at this point in the history
  4. Update src/identities.rs

    tarcieri authored and cuviper committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    e48ffe2 View commit details
    Browse the repository at this point in the history
  5. Update src/identities.rs

    tarcieri authored and cuviper committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    6ab6de2 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    67d9e74 View commit details
    Browse the repository at this point in the history