|
|
|
|
|
by pornel
1467 days ago
|
|
It's not quite RAII, because it's not scope-based. Rust has exclusive ownership with moves by default, so it avoids having a concept of an accessible moved-out-of value that still has to run destructors redundantly. It's not based on reference counting. It's possible to implement reference counting in user code (like C++ shared_ptr), but that is still notably different than languages that use reference counting as their primary memory management strategy (like Swift or CPython). In Rust reference count increases are manual, and refcounted values can be borrowed and safely passed around without updating the reference count. |
|