Finalizer

zio.blocks.scope.Finalizer
trait Finalizer

A handle for registering cleanup actions (finalizers).

Finalizers run in LIFO order when the scope closes. This trait exposes only the defer capability, preventing user code from accessing scope internals like allocate or close.

Attributes

Source
Finalizer.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Scope
class Child[P]
object global

Members list

Value members

Abstract methods

def defer(f: => Unit): DeferHandle

Registers a finalizer to run when the scope closes.

Registers a finalizer to run when the scope closes.

Value parameters

f

a by-name expression to execute during cleanup

Attributes

Returns

a DeferHandle that can be used to cancel the registered finalizer before the scope closes

Source
Finalizer.scala