GetAll returns all items in the buffer, oldest first
()
| 29 | |
| 30 | // GetAll returns all items in the buffer, oldest first |
| 31 | func (b *RingBuffer[T]) GetAll() []T { |
| 32 | result := make([]T, b.count) |
| 33 | for i := 0; i < b.count; i++ { |
| 34 | result[i] = b.items[(b.nextIndex-b.count+i+len(b.items))%len(b.items)] |
| 35 | } |
| 36 | return result |
| 37 | } |
| 38 | |
| 39 | // Capacity returns the capacity of the ring buffer |
| 40 | func (b *RingBuffer[T]) Capacity() int { |
no outgoing calls
no test coverage detected