Rust Tutorial #5: Borrowing and References

In the previous tutorial, we learned about ownership. We saw that passing a value to a function moves it, and you cannot use it anymore. That works, but it is limiting. What if a function only needs to read the data? What if it needs to modify it but give it back? You should not have to move ownership every time. This is where borrowing comes in. Borrowing lets you use a value without taking ownership of it. The value stays with the original owner. ...

March 26, 2026 · 7 min