struct Foo { value: T; } impl Foo { fn eq(self, other: Foo) -> bool { return self.value == other.value; } fn neq(self, other: Foo) -> bool { return !(self == other); } } test "generic neq" { var f1 = Foo{value: 10}; var f2 = Foo{value: 20}; var f3 = Foo{value: 10}; assert(f1 != f2, "f1 should not equal f2"); assert(f1 == f3, "f1 should equal f3"); assert(!(f1 != f3), "f1 != f3 should be false"); }