@@ -214,9 +214,10 @@ on page XX. In this example, we can no longer use `user1` after creating
214
214
` user2 ` because the ` String ` in the ` username ` field of ` user1 ` was moved into
215
215
` user2 ` . If we had given ` user2 ` new ` String ` values for both ` email ` and
216
216
` username ` , and thus only used the ` active ` and ` sign_in_count ` values from
217
- ` user1 ` , then ` user1 ` would still be valid after creating ` user2 ` . Both
218
- ` active ` and ` sign_in_count ` are types that implement the ` Copy ` trait, so the
219
- behavior we discussed in “Stack-Only Data: Copy” on page XX would apply.
217
+ ` user1 ` , then ` user1 ` would still be valid after creating ` user2 ` . Both ` active `
218
+ and ` sign_in_count ` are types that implement the ` Copy ` trait, so the behavior
219
+ we discussed in “Stack-Only Data: Copy” on page XX would apply. We can also
220
+ still use ` user1.email ` in this example, since its value was * not* moved out.
220
221
221
222
### Using Tuple Structs Without Named Fields to Create Different Types
222
223
@@ -345,6 +346,9 @@ won’t work:
345
346
> 3 | username: &str,
346
347
> 4 ~ email: &'a str,
347
348
> |
349
+ >
350
+ > For more information about this error, try `rustc --explain E0106`.
351
+ > error: could not compile `structs` (bin "structs") due to 2 previous errors
348
352
> ```
349
353
>
350
354
> In Chapter 10, we’ll discuss how to fix these errors so you can store
@@ -689,7 +693,7 @@ defined on our `Rectangle` type.
689
693
name, they can have parameters and a return value, and they contain some code
690
694
that’s run when the method is called from somewhere else. Unlike functions,
691
695
methods are defined within the context of a struct (or an enum or a trait
692
- object, which we cover in Chapter 6 and Chapter 17 , respectively), and their
696
+ object, which we cover in Chapter 6 and Chapter 18 , respectively), and their
693
697
first parameter is always `self`, which represents the instance of the struct
694
698
the method is being called on.
695
699
@@ -822,6 +826,10 @@ pointer first. In other words, if `object` is a pointer,
822
826
feature called *automatic referencing and dereferencing*. Calling methods is
823
827
one of the few places in Rust that has this behavior.
824
828
>
829
+ > Here’s how it works: when you call a method with `object.something()`, Rust
830
+ > automatically adds in `&`, `&mut`, or `*` so `object` matches the signature of
831
+ > the method. In other words, the following are the same:
832
+ >
825
833
> Here’s how it works: when you call a method with `object.`something`()`, Rust
826
834
automatically adds in `&`, `&mut`, or `*` so `object` matches the signature of
827
835
the method. In other words, the following are the same:
0 commit comments