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

macro bin derive-cmp-ops

Derives for componetwise opperations

1 unstable release

0.1.0 Apr 17, 2024

#34 in #ops

Download history 17/week @ 2024-06-03 13/week @ 2024-06-10 32/week @ 2024-06-17 21/week @ 2024-06-24 8/week @ 2024-07-08 21/week @ 2024-07-15 5/week @ 2024-07-22 12/week @ 2024-07-29 13/week @ 2024-08-05 6/week @ 2024-08-12 3/week @ 2024-08-19 23/week @ 2024-08-26 12/week @ 2024-09-02 17/week @ 2024-09-09 15/week @ 2024-09-16

68 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

~250–700KB
~17K SLoC