0.1.4 #137

Merged
altavir merged 30 commits from dev into master 2020-09-14 22:49:30 +03:00
Showing only changes of commit 1193349b20 - Show all commits

View File

@ -83,9 +83,12 @@ interface MemoryReader {
/**
* Uses the memory for read then releases the reader.
*/
inline fun Memory.read(block: MemoryReader.() -> Unit) {
inline fun <R> Memory.read(block: MemoryReader.() -> R): R {
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
reader().apply(block).release()
val reader = reader()
val result = reader.block()
reader.release()
return result
}
/**