CloseableScope

Helper for object implementing AutoCloseable.

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
abstract val closed: Boolean

Whether the scope is closed.

Functions

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
open fun ensureNotClosed(lazyMessage: () -> String = { "Scope is closed" })

Throws IllegalStateException if closed is true.

Link copied to clipboard
inline fun <R> notClosed(crossinline lazyMessage: () -> String = { "Scope is closed" }, block: () -> R): R

Returns block's result or throws IllegalStateException if closed is true.

Link copied to clipboard
open fun onClose()

Notifies about scope closing.