1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-20 14:31:15 +02:00

Use existing function as an example for automatic dereferncing (#1799)

This commit is contained in:
Gergely Risko 2024-02-12 15:47:44 +01:00 committed by GitHub
parent 2e2d47c709
commit eb8a5418bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,7 +52,7 @@ fn x_axis(x: i32) -> &(i32, i32) {
required.
- 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
that this re-binds `r`, so that it refers to something else. This is different