Merge remote-tracking branch 'Havvy/master' into Havvy-pull-req
This commit is contained in:
commit
0f34144be3
@ -2504,6 +2504,22 @@ needed because it could also, for example, specify an implementation
|
||||
of `seq<int>`—the `of` clause *refers* to a type, rather than defining
|
||||
one.
|
||||
|
||||
Note that functions do not explicitly have the type parameters that
|
||||
are provided by the iface. It will cause a compile-time error if you
|
||||
include them in the iface or impl.
|
||||
|
||||
## Use of the type `self` in interfaces
|
||||
|
||||
Interfaces may use `self` as a type where the implementation uses its
|
||||
own type. This defines an interface for testing equality of a type with
|
||||
itself:
|
||||
|
||||
~~~~
|
||||
iface eq {
|
||||
fn equals(other: self) -> bool;
|
||||
}
|
||||
~~~~
|
||||
|
||||
## Casting to an interface type
|
||||
|
||||
The above allows us to define functions that polymorphically act on
|
||||
|
Loading…
x
Reference in New Issue
Block a user