Borrow &str when passing String to a function



examples/ownership/string-function/src/main.rs
fn main() {
    let name = String::from("Foo Bar");
    println!("{name}");
    greet(&name);
    println!("{name}");
}

fn greet(text: &str) {
    println!("Greet: {text}");
}

Foo Bar
Greet: Foo Bar
Foo Bar