outputlimit

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package outputlimit provides bounded in-memory encoding destinations.

Index

Constants

This section is empty.

Variables

View Source
var ErrLimit = errors.New("encoded output exceeds size limit")

ErrLimit identifies encoded output that exceeds its configured byte limit.

Functions

This section is empty.

Types

type Buffer

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

Buffer is an io.Writer that retains at most its configured byte limit.

func New

func New(configured, fallback int64) (*Buffer, error)

New returns a buffer using fallback when configured is zero.

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

Bytes returns the retained encoded bytes.

func (*Buffer) Len

func (b *Buffer) Len() int

Len returns the number of retained bytes.

func (*Buffer) Write

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

Write retains p when it fits and otherwise returns ErrLimit without retaining bytes beyond the configured maximum.

Jump to

Keyboard shortcuts

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