span

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package span contains Span, a numeric range.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Span

type Span struct {
	Start int64 // inclusive
	End   int64 // exclusive
}

Span is a numeric range with an inclusive Start and exclusive End index. i.e. [Start, End)

func (Span) Intersection

func (s Span) Intersection(other Span) (Span, bool)

Intersection returns a Span representing the intersection of s and other. Returns false if they do not intersect.

func (Span) Len

func (s Span) Len() int64

Len returns the distance between Start and End

func (Span) Merge

func (s Span) Merge(other Span) (Span, bool)

Merge attempts to combine s and other into a single, unified Span. Returns false if they do not intersect and cannot be merged.

func (Span) String

func (s Span) String() string

Jump to

Keyboard shortcuts

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