use

inline fun <R> use(block: (T) -> R): R

Borrows an instance, runs block with it, and recycles it, including when block throws.

Returns the result of block. The instance must not be used after block returns.