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 c5b23c3 commit 2d23669Copy full SHA for 2d23669
doc/tutorial.md
@@ -2508,6 +2508,18 @@ Note that functions do not explicitly have the type parameters that
2508
are provided by the iface. It will cause a compile-time error if you
2509
include them in the iface or impl.
2510
2511
+## Use of the type `self` in interfaces
2512
+
2513
+Interfaces may use `self` as a type where the implementation uses its
2514
+own type. This defines an interface for testing equality of a type with
2515
+itself:
2516
2517
+~~~~
2518
+iface eq {
2519
+ fn equals(other: self) -> bool;
2520
+}
2521
2522
2523
## Casting to an interface type
2524
2525
The above allows us to define functions that polymorphically act on
0 commit comments