#macro-derive #ops #math

macro bin derive-cmp-ops

Derives for componetwise opperations

1 unstable release

0.1.0 Apr 17, 2024

#28 in #ops

Download history 16/week @ 2025-06-18 12/week @ 2025-06-25 2/week @ 2025-07-02 29/week @ 2025-07-09 39/week @ 2025-07-16 11/week @ 2025-07-23 9/week @ 2025-07-30 4/week @ 2025-08-06 13/week @ 2025-08-13 24/week @ 2025-08-20 19/week @ 2025-08-27 30/week @ 2025-09-03 22/week @ 2025-09-10

97 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

~155–560KB
~13K SLoC