boundedbuffer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLimit = 4096

DefaultLimit is the fallback byte cap for buffers created without a positive limit.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

Buffer is a mutex-guarded io.Writer that retains only the newest limit bytes.

func New

func New(limit int) *Buffer

New returns a Buffer that keeps at most limit newest bytes.

func (*Buffer) Len

func (b *Buffer) Len() int

Len returns the number of retained bytes.

func (*Buffer) String

func (b *Buffer) String() string

func (*Buffer) Write

func (b *Buffer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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