We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0de7aa5 commit ea937dcCopy full SHA for ea937dc
src/test/run-pass/operator-overloading.rs
@@ -34,6 +34,12 @@ impl Point : ops::Neg<Point> {
34
}
35
36
37
+impl Point : ops::Not<Point> {
38
+ pure fn not(&self) -> Point {
39
+ Point {x: !self.x, y: !self.y }
40
+ }
41
+}
42
+
43
impl Point : ops::Index<bool,int> {
44
pure fn index(&self, +x: bool) -> int {
45
if x { self.x } else { self.y }
@@ -55,6 +61,11 @@ fn main() {
55
61
assert -p == Point {x: -11, y: -22};
56
62
assert p[true] == 11;
57
63
assert p[false] == 22;
64
65
+ let q = !p;
66
+ assert q.x == !(p.x);
67
+ assert q.y == !(p.y);
68
58
69
// Issue #1733
59
70
fn~(_x: int){}(p[true]);
60
71
0 commit comments