segments

package
v1.61.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MPL-2.0 Imports: 5 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

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

type ConsecutiveExtentIter added in v1.56.0

type ConsecutiveExtentIter = iter.Seq[Extent]

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 added in v1.56.0

func NewIndexFromSegments(segments []Extent) Index

func (Index) Index added in v1.59.0

func (me Index) Index(i int) Extent

func (Index) LocateIter added in v1.59.0

func (me Index) LocateIter(e Extent) iter.Seq2[int, Extent]

func (Index) LocateOffset added in v1.59.0

func (me Index) LocateOffset(off int64) (ret g.Option[IndexAndOffset])

Returns the Extent that contains the given extent, if it exists. Panics if Extents overlap on the offset.

type IndexAndOffset added in v1.59.0

type IndexAndOffset struct {
	Index  int
	Offset int64
}

type Int

type Int = int64

type Length

type Length = Int

type LengthIter

type LengthIter = iter.Seq[Length]

type Locater

type Locater func(Extent, Callback) bool

Jump to

Keyboard shortcuts

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