Skip to content

Instantly share code, notes, and snippets.

@ansrivas
Created September 12, 2018 23:04
Show Gist options
  • Select an option

  • Save ansrivas/601965b7b005d6a58af540a2c9b40ad6 to your computer and use it in GitHub Desktop.

Select an option

Save ansrivas/601965b7b005d6a58af540a2c9b40ad6 to your computer and use it in GitHub Desktop.
smart_pointers.rs
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