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