RUST Ownership Rules
- Owner can give Permits
- Permits can be of 2 types - R and R/W
- Entities that get the Permit are called Borrowers
- 'R' Permit => & [ Shared Ref ]
- 'R/W' Permit => &mut [ Mutable Ref ]
- If 'R' Permit is given, Owner can also ONLY 'R'.
- If 'R/W' Permit is given, ALL OTHER PERMIT's are Voided. Even the Owner's Permit is voided. Owner can also NO LONGER give Permits. But the mut-Ref Borrower CAN NOW hand out PERMITS.
[ Basically always think about the OWNER, entity that can HAND OUT PERMITS, if a variable is SHARED REF or MUTABLE REF ]
All the above is under the NLL paradigm i.e. Non-Lexical-Lifetime.