segments

package
v1.64.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MPL-2.0 Imports: 5 Imported by: 5 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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