Learn about borrow, ‘&’, and accessing the heap in Rust Programming Language
In this example we access a string (stored on the heap) and modify it using the & to borrow it and update it. Integers can be modified on the stack, but a String is an Array of unknown length so it has to live on the heap… Get the Rust Example Code: