GitHub

scoped_ref

API reference for scoped_ref.

ScopedRef[A]: a reference to a value with resources, swapped safely.

Each value lives in a scope of its own (a generation). set acquires the next value in a fresh generation, then releases the previous one; if acquiring fails, the current value stays. Closing the scope that made the ref releases the current value. Every generation sits at the ref's place in its owner's finalizer order, so owner finalizers added after the ref still see a live value.

Classes