|
|
void | reset () |
| | Drops the current allocation, decrementing the strong count.
|
| |
| auto | assume_init () |
| | Converts an Arc<MaybeUninit<T>> into an Arc<T> after the value has been initialized.
|
| |
|
ref< T > | operator* () noexcept |
| | Dereferences the Arc, returning a mutable reference to the inner value.
|
| |
|
ref< const T > | operator* () const noexcept |
| | Dereferences the Arc, returning a const reference to the inner value.
|
| |
|
T * | operator-> () noexcept |
| | Provides pointer-like mutable access to the inner value.
|
| |
|
T * | operator-> () const noexcept |
| | Provides pointer-like const access to the inner value.
|
| |
|
| operator bool () const noexcept |
| | Returns true if this Arc is non-empty.
|
| |
| usize | strong_count () const noexcept |
| | Returns the number of strong (Arc) pointers to the same allocation.
|
| |
| usize | weak_count () const noexcept |
| | Returns the number of Weak pointers to the same allocation.
|
| |
| Weak< T > | downgrade () const noexcept |
| | Creates a Weak pointer to the same allocation without incrementing the strong count.
|
| |
|
auto | as_ptr () const noexcept |
| | Returns a raw pointer to the managed value.
|
| |
|
auto | get_mut () const noexcept -> Option< mut_ref< T > > |
| | Returns a mutable reference to the inner value if there are no other Arc or Weak pointers to the same allocation.
|
| |
| auto | try_unwrap () -> Result< T, Arc > |
| | Attempts to unwrap the Arc, returning the inner value if this is the only strong reference.
|
| |
| auto | into_raw () noexcept |
| | Consumes the Arc without decrementing the reference count, returning an ArcRaw.
|
| |
|
|
template<typename... Args> |
| static auto | make (Args &&... args) -> Arc |
| | Constructs a new Arc<T>.
|
| |
| static auto | make_uninit () -> Arc< MaybeUninit< T > > |
| | Creates a new Arc containing an uninitialized value.
|
| |
| static auto | pin (rstd::param_t< T > value) -> Pin< Arc< T > > |
| | Creates a new Pin<Arc<T>>.
|
| |
| static Arc | from_raw (ArcRaw< T > r) noexcept |
| | Reconstructs an Arc from an ArcRaw previously obtained via into_raw.
|
| |
|
static bool | ptr_eq (const Arc &a, const Arc &b) noexcept |
| | Returns true if the two Arcs point to the same allocation (not just values that compare as equal).
|
| |
|
static bool | is_unique (const Arc &arc) noexcept |
| | Returns true if this is the only Arc or Weak pointer to the allocation.
|
| |
template<typename T>
class alloc::sync::Arc< T >
A thread-safe reference-counting pointer, analogous to Rust's Arc<T>.
- Template Parameters
-
| T | The type of the value managed by atomic reference counting. |