tur/ref
stdlib/ref.tur
defstruct
Ref
(defstruct Ref [value :int])
heap-allocated single-value container with independent ownership.
Since: Phase B1
defn
ref-new
(ref-new [value] :int)
allocate a new Ref cell on the heap containing value.
Parameters
| value | the int64 value to store inside the Ref |
Since: Phase B1
defn
ref-get
(ref-get [r] :int)
read the value stored in a Ref cell.
Parameters
| r | opaque Ref handle returned by ref-new |
Since: Phase B1
defn
ref-free
(ref-free [r])
free the Ref cell (shallow; does not free the contained value).
Parameters
| r | opaque Ref handle returned by ref-new |
Since: Phase B1
definstance
Clone[ref]
(definstance Clone [ref])
deep-clone a raw ref<T> (TY_REF): allocates a new int64_t cell and copies the value.
Since: Phase B1
definstance
Clone[Ref]
(definstance Clone [Ref])
deep-clone a Ref struct: allocates a new Ref with an independent copy of the value.
Since: Phase B1