2 releases

0.1.1 Mar 6, 2021
0.1.0 Mar 6, 2021

#1338 in Procedural macros

MIT/Apache

8KB
181 lines

OpsDerive

Derive macros for std::ops

Examples

use ops_derive::*;

#[derive(Debug, PartialEq, AutoAdd)]
pub struct Point {
    x: u32,
    y: u32,
    z: u32,
}

impl Point {
	pub fn new(x: u32, y: u32, z: u32) -> Self {
		Self { x, y, z }
	}
}

fn main() {
	let a = Point::new(1, 2, 3);
	let b = Point::new(4, 5, 6);
	let c = Point::new(5, 7, 9);

	assert_eq!(a + b, c);
}

Dependencies

~1.5MB
~37K SLoC