read

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

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