diff --git a/src/with_alloc/alloc_ringbuffer.rs b/src/with_alloc/alloc_ringbuffer.rs index 0c38b59..da0f35b 100644 --- a/src/with_alloc/alloc_ringbuffer.rs +++ b/src/with_alloc/alloc_ringbuffer.rs @@ -301,7 +301,7 @@ unsafe impl RingBuffer for AllocRingBuffer { { let normalized_index = self.readptr + range.start.rem_euclid(self.len()); let index = normalized_index % self.buffer_size(); - let buf = unsafe { slice::from_raw_parts(self.buf, self.buffer_size()) }; + let buf = unsafe { slice::from_raw_parts(self.buf, self.capacity()) }; buf[index..] .iter() .chain(buf[..index].iter()) diff --git a/src/with_const_generics.rs b/src/with_const_generics.rs index 3025d93..87c8afb 100644 --- a/src/with_const_generics.rs +++ b/src/with_const_generics.rs @@ -328,7 +328,7 @@ unsafe impl RingBuffer for ConstGenericRingBuffer