#derive #macro-derive #macro #ops

macro bin derive-cmp-ops

Derives for componetwise opperations

1 unstable release

0.1.0 Apr 17, 2024

#39 in #ops

Download history 6/week @ 2024-07-23 13/week @ 2024-07-30 12/week @ 2024-08-06 5/week @ 2024-08-13 3/week @ 2024-08-20 24/week @ 2024-08-27 12/week @ 2024-09-03 18/week @ 2024-09-10 16/week @ 2024-09-17 35/week @ 2024-09-24 22/week @ 2024-10-01 17/week @ 2024-10-08 22/week @ 2024-10-15 13/week @ 2024-10-22 18/week @ 2024-10-29 18/week @ 2024-11-05

80 downloads per month
Used in 3 crates (via glium-types)

MIT/Apache

12KB
236 lines

Custom derive macros to implement component wise opperations.

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

Alternatively you can include individual opperations.

use derive_cmp_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

~235–680KB
~16K SLoC