apple

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PosLoopDetector

type PosLoopDetector[T constraints.Integer] []T

PosLoopDetector is used for detecting loops when writing decoders, and can short-circuit infinite recursion that can cause stack overflows.

func (*PosLoopDetector[T]) Pop

func (pld *PosLoopDetector[T]) Pop()

Pop removes the most recently added offset from the stack.

func (*PosLoopDetector[T]) Push

func (pld *PosLoopDetector[T]) Push(offset T, detect func())

Push adds the current offset to the stack and executes the supplied detection function

func (*PosLoopDetector[T]) PushAndPop

func (pld *PosLoopDetector[T]) PushAndPop(offset T, detect func()) func()

PushAndPop adds the current offset to the stack, executes the supplied detection function, and returns the Pop method. A good usage of this is to pair this method call with a defer statement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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