Extensions for kotlin.ByteArray


expect fun <R> ByteArray.useMemory(
    offset: Int = 0,
    length: Int,
    block: (Memory) -> R
): R

Execute block of code providing a temporary instance of Memory view of this byte array range starting at the specified offset and having the specified bytes length. By default, if neither offset nor length specified, the whole array is used. An instance of Memory provided into the block should be never captured and used outside of lambda.