You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-11-27 16:28:48 +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>
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
`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
|
||||
same operator in C-family languages; instead, for integer types it negates each
|
||||
bit of the number, which arithmetically is equivalent to subtracting it from -1:
|
||||
`!5 == -6`.
|
||||
The `Not` trait (`!` operator) is notable because it does not convert the
|
||||
argument to `bool` like the same operator in C-family languages; instead, for
|
||||
integer types it flips each bit of the number, which, arithmetically, is
|
||||
equivalent to subtracting the argument from `-1`: `!5 == -6`.
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user