Skip to content

Commit

Permalink
update original
Browse files Browse the repository at this point in the history
  • Loading branch information
funkill committed Feb 27, 2025
1 parent 323a899 commit 6a8a6d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions rustbook-en/src/ch05-01-defining-structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ the struct’s definition.
Note that the struct update syntax uses `=` like an assignment; this is because
it moves the data, just as we saw in the [“Variables and Data Interacting with
Move”][move]<!-- ignore --> section. In this example, we can no longer use
`user1` as a whole after creating `user2` because the `String` in the
`username` field of `user1` was moved into `user2`. If we had given `user2` new
`String` values for both `email` and `username`, and thus only used the
`active` and `sign_in_count` values from `user1`, then `user1` would still be
valid after creating `user2`. Both `active` and `sign_in_count` are types that
implement the `Copy` trait, so the behavior we discussed in the [“Stack-Only
Data: Copy”][copy]<!-- ignore --> section would apply. We can still use
`user1.email` in this example, since its value was _not_ moved out.
`user1` after creating `user2` because the `String` in the `username` field of
`user1` was moved into `user2`. If we had given `user2` new `String` values for
both `email` and `username`, and thus only used the `active` and `sign_in_count`
values from `user1`, then `user1` would still be valid after creating `user2`.
Both `active` and `sign_in_count` are types that implement the `Copy` trait, so
the behavior we discussed in the [“Stack-Only Data: Copy”][copy]<!-- ignore -->
section would apply. We can still use `user1.email` in this example, because its
value was _not_ moved out.

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

Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/ch05-03-method-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name, they can have parameters and a return value, and they contain some code
that’s run when the method is called from somewhere else. Unlike functions,
methods are defined within the context of a struct (or an enum or a trait
object, which we cover in [Chapter 6][enums]<!-- ignore --> and [Chapter
17][trait-objects]<!-- ignore -->, respectively), and their first parameter is
18][trait-objects]<!-- ignore -->, respectively), and their first parameter is
always `self`, which represents the instance of the struct the method is being
called on.

Expand Down

0 comments on commit 6a8a6d3

Please sign in to comment.