Documentation
¶
Overview ¶
Package retain implements bounded logical-item retention from util/output-retention. Push keeps the first maxItems units and counts all omitted units exactly. Finish returns retained items and omission metadata without tool-specific semantics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ItemRetainer ¶
type ItemRetainer[T any] struct { // contains filtered or unexported fields }
ItemRetainer keeps the first maxItems logical units.
func NewItemRetainer ¶
func NewItemRetainer[T any](maxItems int) *ItemRetainer[T]
NewItemRetainer creates a head retainer; negative limits become zero.
func (*ItemRetainer[T]) Finish ¶
func (r *ItemRetainer[T]) Finish() Result[T]
Finish returns the retention result.
func (*ItemRetainer[T]) Push ¶
func (r *ItemRetainer[T]) Push(item T) bool
Push observes an item, retaining it if capacity remains or counting its omission. It reports whether the item was retained.
Click to show internal directories.
Click to hide internal directories.