From 800c6067f028b5a277fae55ad96633f4433b5d8f Mon Sep 17 00:00:00 2001 From: eslopfer Date: Thu, 24 Nov 2022 19:11:46 +0000 Subject: [PATCH] docs(own-and-return): make usage example clearer --- subjects/own-and-return/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/subjects/own-and-return/README.md b/subjects/own-and-return/README.md index 0bb0756f2..793e2dc1e 100644 --- a/subjects/own-and-return/README.md +++ b/subjects/own-and-return/README.md @@ -38,9 +38,12 @@ pub struct Film { } fn main() { - let my_film = Film { name: "Terminator" }; - println!("{}", take_film_name(/* to be implemented */); - println!("{}", read_film_name(/* to be implemented */); + let my_film = Film { name: "Terminator".toString() }; + println!("{}", take_film_name(/* to be implemented */)); + // the order of the print statements is intentional, if your implementation is correct, you should have a compile error because my_film was consumed + println!("{}", read_film_name(/* to be implemented */)); + println!("{}", take_film_name(/*to be implemented*/)) + // you can test this function by commenting out the first print statement, you should see the expected output without errors in this case } ``` @@ -50,6 +53,5 @@ And its output: $ cargo run Terminator Terminator -Terminator $ ```