inline fun Buffer.write(
    block: (memory: Memory, start: Int, endExclusive: Int) -> Int
): Int

Apply block of code with buffer’s memory providing write range indices. The returned value of block lambda should return number of bytes were written. o read/write functions on this buffer should be called inside of block otherwise an undefined behaviour may occur including data damage.