diff --git a/buffer/ring_growing.go b/buffer/ring_growing.go index 86965a51..99262487 100644 --- a/buffer/ring_growing.go +++ b/buffer/ring_growing.go @@ -70,3 +70,13 @@ func (r *RingGrowing) WriteOne(data interface{}) { r.data[(r.readable+r.beg)%r.n] = data r.readable++ } + +// Len returns the number of items in the buffer. +func (r *RingGrowing) Len() int { + return r.readable +} + +// Capacity returns the capacity of the buffer. +func (r *RingGrowing) Capacity() int { + return r.n +} \ No newline at end of file