Core Intermediate
07 Ownership
The heart of Rust. These functions take ownership when they shouldn't -- borrow instead, so the caller keeps its values.
Change sign to take the String by value, append " -- ok", and hand ownership back.
Hints
- Take it by value --
mut s: String-- so the function owns it and may mutate it. - Return
sas the last expression: ownership flows back to the caller.
Reveal solution
fn sign(mut s: String) -> String {
s.push_str(" -- ok");
s
}