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

Attributes for ops macros #242

Open
50U10FCA7 opened this issue Feb 24, 2023 · 1 comment
Open

Attributes for ops macros #242

50U10FCA7 opened this issue Feb 24, 2023 · 1 comment
Assignees
Milestone

Comments

@50U10FCA7
Copy link

50U10FCA7 commented Feb 24, 2023

Proposal

Add a #[add(types(..))] and #[add(forward)] attributes (the same way it works for From and Into) for Add, AddAssign, Sub, SubAssign, Mul and MulAssign macros

It will help to avoid boilerplate for newtype structs.

Example

#[derive(Add, AddAssign, Mul, MulAssign, Sub, SubAssign)]
#[add(types(usize))]
#[mul(forward)]
#[sub(forward)]
pub struct MyIndex(usize);

Edit1: Fixed typo.

@tyranron tyranron added this to the 1.1.0 milestone Feb 24, 2023
@tyranron
Copy link
Collaborator

@50U10FCA7 I guess you've meant #[mul(forward)].

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

No branches or pull requests

3 participants