Skip to content

Commit 063b1f8

Browse files
committed
Ch. 05: further tweak to wording about user1 availability
This is a tricky thing to get “just right”, and I am not *totally* happy with this solution, but I think it’s actually better without the “as a whole” given the addition of the sentence at the end indicating that its fields can still be accessed.
1 parent 5fe7297 commit 063b1f8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/ch05-01-defining-structs.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,14 @@ the struct’s definition.
141141
Note that the struct update syntax uses `=` like an assignment; this is because
142142
it moves the data, just as we saw in the [“Variables and Data Interacting with
143143
Move”][move]<!-- ignore --> section. In this example, we can no longer use
144-
`user1` as a whole after creating `user2` because the `String` in the
145-
`username` field of `user1` was moved into `user2`. If we had given `user2` new
146-
`String` values for both `email` and `username`, and thus only used the
147-
`active` and `sign_in_count` values from `user1`, then `user1` would still be
148-
valid after creating `user2`. Both `active` and `sign_in_count` are types that
149-
implement the `Copy` trait, so the behavior we discussed in the [“Stack-Only
150-
Data: Copy”][copy]<!-- ignore --> section would apply. We can still use
151-
`user1.email` in this example, since its value was _not_ moved out.
144+
`user1` after creating `user2` because the `String` in the `username` field of
145+
`user1` was moved into `user2`. If we had given `user2` new `String` values for
146+
both `email` and `username`, and thus only used the `active` and `sign_in_count`
147+
values from `user1`, then `user1` would still be valid after creating `user2`.
148+
Both `active` and `sign_in_count` are types that implement the `Copy` trait, so
149+
the behavior we discussed in the [“Stack-Only Data: Copy”][copy]<!-- ignore -->
150+
section would apply. We can still use `user1.email` in this example, because its
151+
value was _not_ moved out.
152152

153153
### Using Tuple Structs Without Named Fields to Create Different Types
154154

0 commit comments

Comments
 (0)