Procs
proc newWeakRefable*[T](val: ref T; freeCallback: proc (v: ref T) = nil): WeakRefable[T]
- Create a new object of type T. Invoke freeCallback when the object is freed. Source Edit
proc weakRef*[T](t: WeakRefable[T]): WeakRef[T]
- Convert a strong reference to a weak reference. Source Edit
proc rawPointer*[T](r: WeakRef[T]): pointer
- Get object pointer to by this weak reference as a raw pointer. Source Edit
proc isAlive*[T](r: WeakRef[T]): bool
- Check if this weak reference points to an object that is alive. Source Edit
proc lock*[T](r: WeakRef[T]): WeakRefable[T]
-
Convert a weak reference to a strong reference.
Raises exception if object is not alive.
Source Edit