ruletree

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: BSD-3-Clause, GPL-3.0, MIT, + 1 more Imports: 4 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

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

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

func (*Tree[T]) Compact

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

Compact shrinks internal slice capacities to reduce memory usage.

func (*Tree[T]) Get

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

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

Insert adds a pattern with associated data to the tree.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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