derive_more
derive_more copied to clipboard
Attributes for ops macros
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.
@50U10FCA7 I guess you've meant #[mul(forward)]
.