serde

package
v1.27.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

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

Stack is a generic slice-backed stack pre-allocated to avoid growth allocations for typical serde nesting depths.

func NewStack

func NewStack[T any]() Stack[T]

NewStack returns a Stack pre-allocated with capacity 8.

func (*Stack[T]) Len

func (s *Stack[T]) Len() int

Len returns the number of elements in the stack.

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

Pop removes and returns the top value.

func (*Stack[T]) Push

func (s *Stack[T]) Push(v T)

Push adds a value to the top of the stack.

func (*Stack[T]) Reset

func (s *Stack[T]) Reset()

Reset clears the stack while retaining allocated capacity.

func (*Stack[T]) Top

func (s *Stack[T]) Top() *T

Top returns a pointer to the top value without removing it.

func (*Stack[T]) Values

func (s *Stack[T]) Values() []T

Values returns the underlying slice for indexed access.

Jump to

Keyboard shortcuts

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