A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically
Reference Counted’.
The type Arc<T> provides shared ownership cod
of a value of type T,
allocated in the heap. Invoking clone on Arc produces
a new Arc instance, which points to the same allocation on the heap as the
source Arc, while increasing a reference count. When the last Arc
pointer to a given allocation is destroyed, the value stored in that allocation (often
referred to as “inner value”) is also dropped.
This method by itself is safe, but using it correctly requires extra care.
Another thread can change the weak count at any time,
including potentially between calling this method and acting on the result.
This method by itself is safe, but using it correctly requires extra care.
Another thread can change the strong count at any time,
including potentially between calling this method and acting on the result.