Attribute Macro opimps::impl_uni_ops
source · #[impl_uni_ops]
Expand description
Implements the unary operators for the specified type.
use std::ops::Not;
struct A {
val: bool
}
#[opimps::impl_uni_ops(Not)]
fn not(self: A) -> bool {
return !self.val;
}
let a = A { val: false };
let b = !&a;
assert_eq!(true, b);
let b = !a;
assert_eq!(true, b);