[src]

Module std::rc

Task-local reference-counted boxes (Rc type)

The Rc type provides shared ownership of an immutable value. Destruction is deterministic, and will occur as soon as the last owner is gone. It is marked as non-sendable because it avoids the overhead of atomic reference counting.

The downgrade method can be used to create a non-owning Weak pointer to the box. A Weak pointer can be upgraded to an Rc pointer, but will return None if the value has already been freed.

For example, a tree with parent pointers can be represented by putting the nodes behind Strong pointers, and then storing the parent pointers as Weak pointers.

Rc

Immutable reference counted pointer type

Weak

Weak reference to a reference-counted box

RcBoxPtr