Function readFirstAssumeLength [src]
Reads first length bytes written to the ring buffer into dest;
Asserts that length not greater than ring buffer or dest length
Uses memcpy and so dest must not overlap ring buffer data.
Prototype
pub fn readFirstAssumeLength(self: *RingBuffer, dest: []u8, length: usize) void
Parameters
self: *RingBuffer
dest: []u8
length: usize
Source
pub fn readFirstAssumeLength(self: *RingBuffer, dest: []u8, length: usize) void {
assert(length <= self.len() and length <= dest.len);
const slice = self.sliceAt(self.read_index, length);
slice.copyTo(dest);
self.read_index = self.mask2(self.read_index + length);
}