ringbuf

package
v0.0.0-...-6a835a8 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer[T any] struct {
	// contains filtered or unexported fields
}

func NewBuffer

func NewBuffer[T any](maxLen int, initialCap ...int) *Buffer[T]

func (*Buffer[T]) AppendTo

func (r *Buffer[T]) AppendTo(s []T) []T

func (*Buffer[T]) Bytes

func (r *Buffer[T]) Bytes() []T

Bytes returns a copy of the contents of the buffer. If you want to access buffer data without copying/allocation, consider using Buffer.BytesSeq, Buffer.CopyTo or Buffer.AppendTo.

func (*Buffer[T]) BytesSeq

func (r *Buffer[T]) BytesSeq() iter.Seq[[]T]

BytesSeq returns an iterator over the segments of the buffer. The iterator iterates at least once.

func (*Buffer[T]) CopyTo

func (r *Buffer[T]) CopyTo(s []T) int

func (*Buffer[T]) Len

func (r *Buffer[T]) Len() int

func (*Buffer[T]) MaxLen

func (r *Buffer[T]) MaxLen() int

func (*Buffer[T]) Write

func (r *Buffer[T]) Write(b []T) (int, error)

func (*Buffer[T]) WriteByte

func (r *Buffer[T]) WriteByte(v T) error

type ByteBuffer

type ByteBuffer struct {
	Buffer[byte]
	// contains filtered or unexported fields
}

func NewByteBuffer

func NewByteBuffer(maxLen int, initialCap ...int) *ByteBuffer

func (*ByteBuffer) String

func (r *ByteBuffer) String() string

String returns the contents of the buffer as a string. If *ByteBuffer is nil, it returns "<nil>".

func (*ByteBuffer) WriteRune

func (r *ByteBuffer) WriteRune(ru rune) (int, error)

func (*ByteBuffer) WriteString

func (r *ByteBuffer) WriteString(s string) (int, error)

Jump to

Keyboard shortcuts

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