circlebuffer

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2024 License: BSD-3-Clause Imports: 1 Imported by: 0

README

circlebuffer

Go Reference License Build

circlebuffer provides a modern circular buffer Go library with support for generics.

Getting Started

The circlebuffer package can be added to a project with go-get.

go get cattlecloud.net/go/circlebuffer@latest
import "cattlecloud.net/go/circlebuffer"
Examples
Inserting elements
buf := circlebuffer.New[string](1024)
buf.Insert("alice")
buf.Insert("bob")
Iterating elements
for item := range buf.All() {
  // ...
}
License

The cattlecloud.net/go/circlebuffer module is open source under the BSD license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array[T any] interface {
	All() iter.Seq[T]
	Insert(T)
	Size() int
	Empty() bool
}

func New

func New[T any](capacity int) Array[T]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL