File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -2518,19 +2518,17 @@ interface describes types that support an equality operation:
2518
2518
2519
2519
~~~~
2520
2520
iface eq {
2521
- fn equals(other: self) -> bool;
2521
+ fn equals(&& other: self) -> bool;
2522
2522
}
2523
- ~~~~
2524
-
2525
- In an implementation for type ` int ` , the ` equals ` method takes an
2526
- ` int ` argument:
2527
2523
2528
- ~~~~
2529
2524
impl of eq for int {
2530
- fn equals(other: int) { other == self }
2525
+ fn equals(&& other: int) -> bool { other == self }
2531
2526
}
2532
2527
~~~~
2533
2528
2529
+ Notice that ` equals ` takes an ` int ` argument, rather than a ` self ` argument, in
2530
+ an implementation for type ` int ` .
2531
+
2534
2532
## Casting to an interface type
2535
2533
2536
2534
The above allows us to define functions that polymorphically act on
You can’t perform that action at this time.
0 commit comments