// &mut String lets a function extend the caller's value fn add_ext(s: &mut String) { s.push_str(".txt"); } fn main() { let mut name = String::from("file"); add_ext(&mut name); println!("{name}"); }
&mut String appends in place