use

inline fun <T, R> T.use(block: (T) -> R, close: T.() -> Unit): R(source)

Copied and adapted from kotlin.use.