From d77272a5b42b3c4788362f62b878ba697ec10a3c Mon Sep 17 00:00:00 2001 From: Keshav Chakravarthy Date: Tue, 28 May 2024 14:38:34 +0530 Subject: [PATCH] Better example for ownership transfer using String (#68) * Better example for ownership transfer using String * Update book/src/03_ticket_v1/06_ownership.md --------- Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> --- book/src/03_ticket_v1/06_ownership.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/src/03_ticket_v1/06_ownership.md b/book/src/03_ticket_v1/06_ownership.md index 70aff26..cc4e673 100644 --- a/book/src/03_ticket_v1/06_ownership.md +++ b/book/src/03_ticket_v1/06_ownership.md @@ -95,8 +95,8 @@ Ownership can be transferred. If you own a value, for example, you can transfer ownership to another variable: ```rust -let a = 42; // <--- `a` is the owner of the value `42` -let b = a; // <--- `b` is now the owner of the value `42` +let a = "hello, world".to_string(); // <--- `a` is the owner of the String +let b = a; // <--- `b` is now the owner of the String ``` Rust's ownership system is baked into the type system: each function has to declare in its signature