carbotaniuman / auto_ops

Macros for overloading operators easily in Rust.
MIT License
34 stars 9 forks source link

Is there a way to automate this for all ops? #1

Closed caemor closed 2 years ago

caemor commented 4 years ago

Is there a way for a separate macro and it works for all these operations (OP : +, -, *, /, %, &, |, ^, <<, >>) automatically?

Eg:

impl_op_ex!(op |a: &DonkeyKong, b: &DonkeyKong| -> DonkeyKong::new(a.bananas op b.bananas));
carbotaniuman commented 3 years ago

Can you elaborate a little more? Would all of the ops simply delegate to that closure?