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

feat(macros): add sub mul div zero derives #328

Conversation

milancermak
Copy link
Contributor

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the new behavior?

PR introduces a bunch of new macros that allow to derive Add, Sub, Mul, Div, AddAssign, SubAssign, MulAssign, DivAssign and Zero traits. Now we can have a struct like this:

#[derive(Add, AddAssign, Sub, SubAssign, Mul, MulAssign, Div, DivAssign, Zero)]
struct Foo {
    x: u8,
    y: u16,
    z: u32
}

and all the basic ops are available out of the box.

The macros work for more complex types as well (generic & nested structs).

Does this introduce a breaking change?

  • Yes
  • No

Other information

I've cleaned up the package structure to be more modular as it grows.

@milancermak milancermak force-pushed the feat/add-sub-mul-div-zero-derive branch from c597f75 to 006783d Compare August 23, 2024 19:11
Copy link
Collaborator

@enitrat enitrat left a comment

Choose a reason for hiding this comment

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

awesome!

@enitrat enitrat merged commit fdf4098 into keep-starknet-strange:main Aug 30, 2024
7 checks passed
@milancermak milancermak deleted the feat/add-sub-mul-div-zero-derive branch August 30, 2024 19:44
@github-actions github-actions bot locked and limited conversation to collaborators Sep 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants