Skip to content

sync.arc

fn new #

fn new[T](value T) Arc[T]

new moves value into a new atomically reference-counted allocation.

fn ptr_eq #

fn ptr_eq[T](a &Arc[T], b &Arc[T]) bool

ptr_eq reports whether two Arc values point to the same allocation.

fn (Arc[T]) clone #

fn (a &Arc[T]) clone() Arc[T]

clone creates another owner of the same allocation.

fn (Arc[T]) drop #

fn (mut a Arc[T]) drop()

drop releases one strong reference and destroys T after the last release.

fn (Arc[T]) get #

fn (a &Arc[T]) get() &T

get returns a shared borrow of the value stored in this Arc.

fn (Arc[T]) strong_count #

fn (a &Arc[T]) strong_count() u64

strong_count returns the number of strong references to this allocation. The count can change immediately when other threads clone or drop the Arc.

struct Arc #

struct Arc[T] {
	inner &ArcInner[T]
}

Arc provides shared ownership of a heap-allocated value of type T. Cloning an Arc increments its atomic strong count instead of cloning T.