MCPcopy
hub / github.com/expr-lang/expr / Enqueue

Method Enqueue

internal/ring/ring.go:60–67  ·  view source on GitHub ↗

Enqueue adds an item to the ring.

(v T)

Source from the content-addressed store, hash-verified

58
59// Enqueue adds an item to the ring.
60func (r *Ring[T]) Enqueue(v T) {
61 if r.len == len(r.data) {
62 r.grow()
63 }
64 writePos := (r.back + r.len) % len(r.data)
65 r.data[writePos] = v
66 r.len++
67}
68
69func (r *Ring[T]) grow() {
70 s := make([]T, len(r.data)+r.chunkSize)

Callers 3

emitValueMethod · 0.80
emitEOFMethod · 0.80
testRingOpFunction · 0.80

Calls 1

growMethod · 0.95

Tested by 1

testRingOpFunction · 0.64