Module alloc::sync

1.0.0 · source ·
Expand description

Thread-safe reference-counting pointers.

See the Arc<T> documentation for more details.

Note: This module is only available on platforms that support atomic loads and stores of pointers. This may be detected at compile time using #[cfg(target_has_atomic = "ptr")].

Macros

Structs

  • A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
  • ArcInner 🔒
  • Weak is a version of Arc that holds a non-owning reference to the managed allocation. The allocation is accessed by calling upgrade on the Weak pointer, which returns an Option<Arc<T>>.
  • WeakInner 🔒
    Helper type to allow accessing the reference counts without making any assertions about the data field.

Constants

  • The error in case either counter reaches above MAX_REFCOUNT, and we can panic safely.
  • A soft limit on the amount of references that may be made to an Arc.

Traits

Functions