Rust Smart Pointer

Rust's ownership mechanism limit there is only one owner of a variable. When the variable goes out of scope, Rust automatically recycle the space of that variable. What smart pointers do is that they allow multiple owner of a variable. And when the variable goes out of scope, the related ownerships get released automatically.

The Rust standard library provides Rc to set multiple references to a variable and RefCell to allow interior mutability of a generic type. For example, you could define >> to implement tree structure in Rust.

No Comments Yet