ops-derive2

Crates.ioops-derive2
lib.rsops-derive2
version0.2.0
created_at2025-08-08 16:46:10.543871+00
updated_at2025-08-08 18:55:32.869908+00
descriptionDerive macros for implementing the std::ops traits.
homepage
repository
max_upload_size
id1787029
size11,684
DDAN (DDAN-17)

documentation

README

ops-derive2

This is a fork of the ops-derive crate.

Extra features:

  • Tuple struct support
  • std::ops::* is implemented for Into<T> instead of T

Examples

use ops_derive2::*;

#[derive(Debug, PartialEq, AutoAdd)]
pub struct Point(u32, u32, 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);
}
Commit count: 0

cargo fmt