Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Range ¶
type Range[T cmp.Ordered] 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 ordered values [Start, End].
func NewRange ¶
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. The boolean result reports whether the ranges overlap; when it is false the returned range is the zero value and its bounds carry no meaning.
func (Range[T]) IsNotEmpty ¶ added in v0.21.3
IsNotEmpty returns true if the range contains at least one value (start <= end).
Click to show internal directories.
Click to hide internal directories.