mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-21 06:36:31 +02:00
Use existing function as an example for automatic dereferncing (#1799)
This commit is contained in:
parent
2e2d47c709
commit
eb8a5418bd
@ -52,7 +52,7 @@ fn x_axis(x: i32) -> &(i32, i32) {
|
|||||||
required.
|
required.
|
||||||
|
|
||||||
- Rust will auto-dereference in some cases, in particular when invoking methods
|
- Rust will auto-dereference in some cases, in particular when invoking methods
|
||||||
(try `r.count_ones()`). There is no need for an `->` operator like in C++.
|
(try `r.is_ascii()`). There is no need for an `->` operator like in C++.
|
||||||
|
|
||||||
- In this example, `r` is mutable so that it can be reassigned (`r = &b`). Note
|
- In this example, `r` is mutable so that it can be reassigned (`r = &b`). Note
|
||||||
that this re-binds `r`, so that it refers to something else. This is different
|
that this re-binds `r`, so that it refers to something else. This is different
|
||||||
|
Loading…
x
Reference in New Issue
Block a user