MCPcopy Index your code
hub / github.com/expr-lang/expr / Dequeue

Method Dequeue

internal/ring/ring.go:49–57  ·  view source on GitHub ↗

Dequeue returns the oldest value.

()

Source from the content-addressed store, hash-verified

47
48// Dequeue returns the oldest value.
49func (r *Ring[T]) Dequeue() (v T, ok bool) {
50 if r.len == 0 {
51 return v, false
52 }
53 v, r.data[r.back] = r.data[r.back], v // retrieve and clear mem
54 r.len--
55 r.back = (r.back + 1) % len(r.data)
56 return v, true
57}
58
59// Enqueue adds an item to the ring.
60func (r *Ring[T]) Enqueue(v T) {

Callers 2

NextMethod · 0.80
testRingOpFunction · 0.80

Calls

no outgoing calls

Tested by 1

testRingOpFunction · 0.64