mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-19 17:03:13 +02:00
Update default-methods.md (#747)
* Update default-methods.md This commit resolves two issues. a) typo: Equal -> Equals b) update details to comply w/ example source code * Update src/traits/default-methods.md Co-authored-by: Edward Liaw <edliaw@google.com> --------- Co-authored-by: Martin Geisler <martin@geisler.net> Co-authored-by: Edward Liaw <edliaw@google.com>
This commit is contained in:
parent
f0d027b04a
commit
da569cd7c4
@ -34,7 +34,7 @@ fn main() {
|
|||||||
|
|
||||||
* Move method `not_equal` to a new trait `NotEqual`.
|
* Move method `not_equal` to a new trait `NotEqual`.
|
||||||
|
|
||||||
* Make `NotEqual` a super trait for `Equal`.
|
* Make `Equals` a super trait for `NotEqual`.
|
||||||
```rust,editable,compile_fail
|
```rust,editable,compile_fail
|
||||||
trait NotEqual: Equals {
|
trait NotEqual: Equals {
|
||||||
fn not_equal(&self, other: &Self) -> bool {
|
fn not_equal(&self, other: &Self) -> bool {
|
||||||
@ -55,6 +55,6 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
* With the blanket implementation, you no longer need `NotEqual` as a super trait for `Equal`.
|
* With the blanket implementation, you no longer need `Equals` as a super trait for `NotEqual`.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user