- &
Rust ownership - borrow String
- We can tell Rust that a variable borrows the ownership.
- In this case both variables have (read) access to the variable.
- We can have as many (read) borrows as we need.
examples/ownership/string-borrow/src/main.rs
fn main() { let x = String::from("Foo Bar"); println!("{x}"); let y = &x; println!("{y}"); println!("{x}"); println!("{y}"); }