[][src]Attribute Macro opimps::impl_ops

#[impl_ops]

Implements the permutations of owned and borrowed data.

use std::ops::Mul;

pub struct ANumber {
    val: i32
}

#[opimps::impl_ops(Mul)] 
fn mul(self: ANumber, rhs: i32) -> i32 {
    return self.val * rhs;
}
 
let a = ANumber { val: 4 };
let b = 7;
 
assert_eq!(28, &a * &b);
assert_eq!(28, a * b);