Function len [src]

Returns the length of data available for reading

Prototype

pub fn len(self: RingBuffer) usize

Parameters

self: RingBuffer

Source

pub fn len(self: RingBuffer) usize { const wrap_offset = 2 * self.data.len * @intFromBool(self.write_index < self.read_index); const adjusted_write_index = self.write_index + wrap_offset; return adjusted_write_index - self.read_index; }