Ownership Transfer
Write a function make_greeting that takes ownership of a String name and returns a new String with a greeting. Print the result in main.
Expected output:
text
Welcome, Ferris!
Hints:
- Function signature:
fn make_greeting(name: String) -> String - Use
format!("Welcome, {}!", name)to build the new string - The function takes ownership, so
namemoves in — that's OK since we return a new string
rust
fn main() {
}