Package-level declarations

Types

Link copied to clipboard

Collects resources and closes them cleanly in reversed order.

Link copied to clipboard

Marks experimental API that is not final and subject to change.

Link copied to clipboard
sealed interface OperatingSystem

Test

Link copied to clipboard
fun interface SuspendCloseable

A resource that can be closed or released and must suspend to do so.

Link copied to clipboard
sealed interface Target

Kotlin/Multiplatform compilation target.

Properties

Link copied to clipboard

Functions

Link copied to clipboard

Wraps this AutoCloseable as if it needed to suspend, allowing APIs to only support SuspendCloseables.

Link copied to clipboard
inline suspend fun <R> autoclose(block: Closer.() -> R): R

Creates a Closer scope and automatically closes it.

inline suspend fun <R> autoclose(vararg closeables: SuspendCloseable, block: Closer.() -> R): R

Creates a Closer scope, adds all provided closeables, and automatically closes it.

Link copied to clipboard
fun Closer(): Closer

Create a new empty Closer.

fun Closer(vararg closeables: SuspendCloseable): Closer

Create a new Closer and add closeables to it.

Link copied to clipboard
operator fun Closer.plusAssign(autoCloseable: AutoCloseable)

Remember to close autoCloseable together with this closer.

operator fun Closer.plusAssign(suspendCloseable: SuspendCloseable)

Remember to close suspendCloseable together with this closer.

Link copied to clipboard
inline suspend fun <T : SuspendCloseable?, R> T.use(block: (T) -> R): R

Executes the given block function on this resource and then closes it down correctly whether an exception is thrown or not.