Documentation
¶
Index ¶
- type Ring
- func (r *Ring) Avail() int
- func (r *Ring) Do(f func(interface{}))
- func (r *Ring) Len() int
- func (r *Ring) Move(n int) interface{}
- func (r *Ring) Next() interface{}
- func (r *Ring) Pop() interface{}
- func (r *Ring) Prev() interface{}
- func (r *Ring) Push(val interface{})
- func (r *Ring) SetValue(val interface{})
- func (r *Ring) Value() interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring provides a thread safe length limited ring buffer that operates in a FIFO manner
func (*Ring) Do ¶
func (r *Ring) Do(f func(interface{}))
Do calls function f on each element in the ring iterating forward from the current position
func (*Ring) Move ¶
Move moves the currnet position n % r.Len() elements backwards (n < 0) or forward (n > 0) in the ring and returns the destination value. r must not be empty
func (*Ring) Next ¶
func (r *Ring) Next() interface{}
Next moves the ring one element forward, and returns the destination value. r must not be empty
func (*Ring) Prev ¶
func (r *Ring) Prev() interface{}
Prev rmoves the ring element backward, and returns the destination value. r must not be empty
func (*Ring) Push ¶
func (r *Ring) Push(val interface{})
Push adds elements to the ring; if the ring is full it replaces the oldest element
Click to show internal directories.
Click to hide internal directories.