proxy.golang.org : github.com/nsf/ringbuffer
Package provides fixed length FIFO ring buffer functionality. You can use a generic data structure with methods, which is forced to use slices due to Go language limitations (no generic array lengths): Or you can use generic functions with your own state variables. Here you can use plain arrays and integer types of arbitrary size: The logic is the simplest implementation straight from wikipedia: https://en.wikipedia.org/wiki/Circular_buffer. In short: there are read and write pointers as integer indices and a buffer of capacity+1 space. An extra element is reserved to distinguish between full/empty state. When using plain generic functions with smaller integer types, be aware of integer overflows. No care taken to prevent these.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/nsf/ringbuffer
License: MIT
Latest release: 4 months ago
First release: 4 months ago
Namespace: github.com/nsf
Stars: 1 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 15 hours ago