Created
September 12, 2018 23:04
-
-
Save ansrivas/601965b7b005d6a58af540a2c9b40ad6 to your computer and use it in GitHub Desktop.
smart_pointers.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Box<T> is for single ownership. | |
| Rc<T> is for multiple ownership. | |
| Arc<T> is for multiple ownership, but threadsafe. | |
| Cell<T> is for “interior mutability” for Copy types; that is, when you need to mutate something behind a &T. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment