Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comparable ¶
type Comparable interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 |
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 |
~float32 | ~float64 |
~string
}
Comparable is a type constraint for types that support comparison operations. It includes all numeric types and strings.
type Range ¶
type Range[T Comparable] struct { Start T // Start is the inclusive start of the range End T // End is the inclusive end of the range }
Range represents an inclusive range of comparable values [Start, End].
func NewRange ¶
func NewRange[T Comparable](start, end T) Range[T]
NewRange creates a new range with the given start and end values. The range is inclusive on both ends: [start, end].
func (Range[T]) Contains ¶
Contains checks if the range contains the given value (inclusive). Returns true if start <= value <= end.
func (Range[T]) Intersection ¶
Intersection returns the intersection of this range with another range. Returns an empty range if there is no intersection.
Click to show internal directories.
Click to hide internal directories.