]> code.octet-stream.net Git - test-operator-impl/blob - src/main.rs
Initial commit
[test-operator-impl] / src / main.rs
1 fn main() {
2 let m1 = MyType(3);
3 let m2 = MyType(5);
4
5 assert_eq!(m1 & m2, MyType(1));
6 }
7
8 #[derive(Debug, PartialEq)]
9 struct MyType(u32);
10 impl std::ops::BitAnd for MyType {
11 type Output = MyType;
12
13 fn bitand(self, rhs: Self) -> Self::Output {
14 Self(self.0 & rhs.0)
15 }
16 }