]> code.octet-stream.net Git - test-operator-impl/commitdiff
Initial commit master
authorThomas Karpiniec <tom.karpiniec@outlook.com>
Wed, 4 Jun 2025 01:27:47 +0000 (11:27 +1000)
committerThomas Karpiniec <tom.karpiniec@outlook.com>
Wed, 4 Jun 2025 01:27:47 +0000 (11:27 +1000)
.gitignore [new file with mode: 0644]
Cargo.lock [new file with mode: 0644]
Cargo.toml [new file with mode: 0644]
src/main.rs [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..ea8c4bf
--- /dev/null
@@ -0,0 +1 @@
+/target
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644 (file)
index 0000000..9c1ed73
--- /dev/null
@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "test-operator-impl"
+version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644 (file)
index 0000000..a5439b9
--- /dev/null
@@ -0,0 +1,6 @@
+[package]
+name = "test-operator-impl"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
diff --git a/src/main.rs b/src/main.rs
new file mode 100644 (file)
index 0000000..388dfc1
--- /dev/null
@@ -0,0 +1,16 @@
+fn main() {
+    let m1 = MyType(3);
+    let m2 = MyType(5);
+    
+    assert_eq!(m1 & m2, MyType(1));
+}
+
+#[derive(Debug, PartialEq)]
+struct MyType(u32);
+impl std::ops::BitAnd for MyType {
+    type Output = MyType;
+
+    fn bitand(self, rhs: Self) -> Self::Output {
+        Self(self.0 & rhs.0)
+    }
+}
\ No newline at end of file