ruletree

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 4 more Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data comparable

type Tree added in v0.13.0

type Tree[T Data] struct {
	// contains filtered or unexported fields
}

Tree is a prefix tree for storing and retrieving data associated with adblock-style patterns.

Insert and Compact must not run concurrently with Get.

func New added in v0.13.0

func New[T Data]() *Tree[T]

func (*Tree[T]) Compact added in v0.13.0

func (t *Tree[T]) Compact()

Compact shrinks internal slice capacities to reduce memory usage.

func (*Tree[T]) Get added in v0.13.0

func (t *Tree[T]) Get(url string) []T

Get retrieves data matching the given URL.

The URL is expected to be a valid URL with scheme and host.

func (*Tree[T]) Insert added in v0.13.0

func (t *Tree[T]) Insert(pattern string, v T)

Insert adds a pattern with associated data to the tree.

Jump to

Keyboard shortcuts

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