trie

package
v0.0.0-...-d2f97bb Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Trie

type Trie[E comparable, T any] struct {
	// contains filtered or unexported fields
}

func New

func New[E comparable, T any](value T) *Trie[E, T]

func (*Trie[E, T]) Delete

func (t *Trie[E, T]) Delete(path []E) (ok bool)

Delete - delete one child node

func (*Trie[E, T]) Insert

func (t *Trie[E, T]) Insert(path []E, value T) bool

Insert - insert one child node - NOTE - Insert is not recursive

func (*Trie[E, T]) List

func (t *Trie[E, T]) List(prefix []E) func(yield func(name E, value T) bool)

List - yield all childrens of a path

func (*Trie[E, T]) Load

func (t *Trie[E, T]) Load(path []E) (value T, ok bool)

Load - return the value attached to node at path

func (*Trie[E, T]) ReduceAll

func (t *Trie[E, T]) ReduceAll(reducer func(parent T, child T) (newParent T)) T

func (*Trie[E, T]) ReducePartial

func (t *Trie[E, T]) ReducePartial(path []E, reducer func(parent T, child T) (newParent T))

func (*Trie[E, T]) Store

func (t *Trie[E, T]) Store(path []E, value T) (ok bool)

Store - store the value into the node at path

func (*Trie[E, T]) Walk

func (t *Trie[E, T]) Walk(prefix []E) func(yield func(path []E, value T) bool)

Walk - yield all nodes in the subtree of a path

Jump to

Keyboard shortcuts

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