segments

package
v0.0.0-...-6e19431 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scan

func Scan(haystack LengthIter, needle Extent, callback Callback) bool

Returns true if callback returns false early, or all segments in the haystack for the needle are found.

func ScanConsecutive

func ScanConsecutive(haystack ConsecutiveExtentIter, needle Extent, callback Callback) bool

Returns true if callback returns false early, or all segments in the haystack for the needle are found.

Types

type Callback

type Callback = func(segmentIndex int, segmentBounds Extent) bool

type ConsecutiveExtentIter

type ConsecutiveExtentIter = func() (Extent, bool)

type Extent

type Extent struct {
	Start, Length Int
}

func (Extent) End

func (e Extent) End() Int

type Index

type Index struct {
	// contains filtered or unexported fields
}

func NewIndex

func NewIndex(segments LengthIter) (ret Index)

func NewIndexFromSegments

func NewIndexFromSegments(segments []Extent) Index

func (Index) Locate

func (me Index) Locate(e Extent, output Callback) bool

Returns true if the callback returns false early, or extents are found in the index for all parts of the given extent.

type Int

type Int = int64

type Length

type Length = Int

type LengthIter

type LengthIter = func() (Length, bool)

type Locater

type Locater func(Extent, Callback) bool

func LocaterFromLengthIter

func LocaterFromLengthIter(li LengthIter) Locater

Jump to

Keyboard shortcuts

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