Access data without taking ownership using borrow and borrow mut.
- Immutable borrow: Read-only access with
borrow - Mutable borrow: Read-write access with
borrow mut - Borrow rules: Enforced at compile time
- You can have multiple immutable borrows at the same time
- You can have only one mutable borrow at a time
- You cannot have mutable and immutable borrows at the same time
- Borrows must not outlive the owner
oxide run main.ox