Skip to content

Commit d77272a

Browse files
Better example for ownership transfer using String (mainmatter#68)
* Better example for ownership transfer using String * Update book/src/03_ticket_v1/06_ownership.md --------- Co-authored-by: Luca Palmieri <[email protected]>
1 parent deb4ccb commit d77272a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

book/src/03_ticket_v1/06_ownership.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ Ownership can be transferred.
9595
If you own a value, for example, you can transfer ownership to another variable:
9696

9797
```rust
98-
let a = 42; // <--- `a` is the owner of the value `42`
99-
let b = a; // <--- `b` is now the owner of the value `42`
98+
let a = "hello, world".to_string(); // <--- `a` is the owner of the String
99+
let b = a; // <--- `b` is now the owner of the String
100100
```
101101

102102
Rust's ownership system is baked into the type system: each function has to declare in its signature

0 commit comments

Comments
 (0)