attrstack

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT, MIT Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package attrstack holds the attribute stack of the compiled evaluator of the rules.

Index

Constants

View Source
const Inline = 8

Inline is the number of entries that live in the struct itself.

A path of n segments pushes n-1 entries, so a path of up to Inline+1 segments makes no allocation. A longer one spills: Stack.Reserve makes room for the spill in one allocation.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

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

Stack is the visitor's attribute stack. The first Inline entries live in the struct itself so that, with evalState on the goroutine stack, nested paths do not allocate; deeper entries spill to more. Nothing takes the address of inline, which would move the whole evalState to the heap.

func (*Stack) Clear

func (s *Stack) Clear()

Clear empties the stack.

func (*Stack) Len

func (s *Stack) Len() int

Len is the number of entries on the stack.

func (*Stack) Pop

func (s *Stack) Pop()

Pop drops the last pushed entry; s must not be empty.

func (*Stack) Push

func (s *Stack) Push(value any)

Push adds value on top of the stack.

func (*Stack) Reserve added in v1.4.0

func (s *Stack) Reserve(n int)

Reserve says that n entries beyond the inline ones may come, so that the first push that spills allocates room for all of them at once. It allocates nothing itself: a path that stops before it spills costs nothing.

func (*Stack) Top

func (s *Stack) Top() any

Top returns the last pushed entry; s must not be empty.

Jump to

Keyboard shortcuts

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