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

macro bin derive-cmp-ops

Derives for componetwise opperations

1 unstable release

0.1.0 Apr 17, 2024

#41 in #ops

Download history 3/week @ 2024-11-13 18/week @ 2024-11-20 20/week @ 2024-11-27 20/week @ 2024-12-04 28/week @ 2024-12-11 9/week @ 2024-12-18 1/week @ 2025-01-01 24/week @ 2025-01-08 15/week @ 2025-01-15 7/week @ 2025-01-22 14/week @ 2025-01-29 18/week @ 2025-02-05 22/week @ 2025-02-12 13/week @ 2025-02-19 19/week @ 2025-02-26

74 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

~195–630KB
~15K SLoC