Borrow Checker
202307221748
Status: #idea
Tags: Rust
Borrow Checker
- Variables have 3 kinds of permissions:
- Read: Data can be copied to another location
- Write: Data can be mutated in-place
- Own: Data can be moved or dropped
- By default a variable has
permissions on its data. - They
mutkeyword gives a variablepermissions - A reference can temporarily remove these permissions
Info
Immutable references permit aliasing but NOT mutation.
Attention
Rust references have a lifetime from its birth (when it is created) to its death (the last time the reference is used)