You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-11-29 16:57:35 +02:00
docs: improve language in std-traits section (#2872)
Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
As with the standard-library types, spend time reviewing the documentation for
|
As with the standard library types, spend time reviewing the documentation for
|
||||||
each trait.
|
each trait.
|
||||||
|
|
||||||
This section is long. Take a break midway through.
|
This section is long. Take a break midway through.
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ Discussion points:
|
|||||||
- You could implement `Add` for two different types, e.g.
|
- You could implement `Add` for two different types, e.g.
|
||||||
`impl Add<(i32, i32)> for Point` would add a tuple to a `Point`.
|
`impl Add<(i32, i32)> for Point` would add a tuple to a `Point`.
|
||||||
|
|
||||||
The `Not` trait (`!` operator) is notable because it does not "boolify" like the
|
The `Not` trait (`!` operator) is notable because it does not convert the
|
||||||
same operator in C-family languages; instead, for integer types it negates each
|
argument to `bool` like the same operator in C-family languages; instead, for
|
||||||
bit of the number, which arithmetically is equivalent to subtracting it from -1:
|
integer types it flips each bit of the number, which, arithmetically, is
|
||||||
`!5 == -6`.
|
equivalent to subtracting the argument from `-1`: `!5 == -6`.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user