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.
Click to show internal directories.
Click to hide internal directories.