Companion
Functions
Extensions
Link copied to clipboard
fun <A : AutoCloseable> Resource.Companion.fromAutoCloseable(f: suspend () -> A): Resource<A>
Content copied to clipboard
Creates a Resource from an AutoCloseable, which uses AutoCloseable.close for releasing.
Link copied to clipboard
fun <A : Closeable> Resource.Companion.fromCloseable(f: suspend () -> A): Resource<A>
Content copied to clipboard
Creates a Resource from an Closeable, which uses Closeable.close for releasing.
Link copied to clipboard
fun Resource.Companion.fromExecutor(f: suspend () -> ExecutorService): Resource<CoroutineContext>
Content copied to clipboard
Creates a single threaded CoroutineContext as a Resource. Upon release an orderly shutdown of the ExecutorService takes place in which previously submitted tasks are executed, but no new tasks will be accepted.
Link copied to clipboard
fun Resource.Companion.singleThreadContext(name: String): Resource<CoroutineContext>
Content copied to clipboard
Creates a single threaded CoroutineContext as a Resource. Upon release an orderly shutdown of the ExecutorService takes place in which previously submitted tasks are executed, but no new tasks will be accepted.