#derive #macro-derive #ops #macro #math

yanked derrive-ops

Derives for componetwise opperations

0.1.0 Apr 17, 2024

#43 in #ops

Download history 128/week @ 2024-04-17

128 downloads per month

MIT/Apache

12KB
236 lines

Custom derive macros to implement component wise opperations.

use derive_ops::CmpOps;
#[derive(CmpOps)]
struct Point{
    a: f32,
    b: i8,
    c: i16
}

Alternatively you can include individual opperations.

use derive_ops::{CmpRemAssign, CmpMul};
#[derive(CmpRemAssign, CmpMul)]
struct Point{
    a: f32,
    b: i8,
    c: i16
}

Includes derives for add, add assign, sub, sub assign, mul, mul assign, div, div assign, rem, rem assign and neg

Dependencies

~315–770KB
~19K SLoC