blob: 76a3925fe19ceada88052a0dc78ec9664fa42cd7 [file] [log] [blame] [edit]
extern crate overload;
use overload::overload;
use std::ops;
#[derive(PartialEq, Debug)]
struct A(i32);
#[derive(PartialEq, Debug)]
struct B(i32);
overload!(- (a: A) -> B { B(-a.0) });
#[test]
fn neg() {
assert_eq!(-A(3), B(-3));
}
overload!(! (a: A) -> B { B(!a.0) });
#[test]
fn not() {
assert_eq!(!A(3), B(!3));
}