Function sliceAt [src]

Returns a Slice for the region of the ring buffer starting at self.mask(start_unmasked) with the specified length.

Prototype

pub fn sliceAt(self: RingBuffer, start_unmasked: usize, length: usize) Slice

Parameters

self: RingBufferstart_unmasked: usizelength: usize

Source

pub fn sliceAt(self: RingBuffer, start_unmasked: usize, length: usize) Slice { assert(length <= self.data.len); const slice1_start = self.mask(start_unmasked); const slice1_end = @min(self.data.len, slice1_start + length); const slice1 = self.data[slice1_start..slice1_end]; const slice2 = self.data[0 .. length - slice1.len]; return Slice{ .first = slice1, .second = slice2, }; }