blob: d17506ffe136b99170372d61869fe456e0ef5fff (
plain)
1
2
3
4
5
6
7
8
9
|
[[Creating a reference to a variable is called borrowing]]
---
If a function modifies a borrowed variable, we can try to find a way to shorten the lifetime of the borrow.
One way would be to clone the value into a new variable and mutate that, but it can be expensive.
Another way could be to use some property of the variable instead of the variable itself, ie the length of a string.
|