Documentation ¶
Overview ¶
Package rangeit allows to iterate over a range of numbers.
Iterator functions:
Index ¶
- func Count[T constraints.Integer]() itkit.Iterator[T]
- func CountFrom[T constraints.Integer](start T) itkit.Iterator[T]
- func CountStep[T constraints.Integer](start, step T) itkit.Iterator[T]
- func Range[T constraints.Signed](stop T) itkit.Iterator[T]
- func RangeFrom[T constraints.Signed](start, stop T) itkit.Iterator[T]
- func RangeStep[T constraints.Signed](start, stop, step T) itkit.Iterator[T]
- type CountIterator
- type RangeIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Count ¶ added in v0.7.0
func Count[T constraints.Integer]() itkit.Iterator[T]
Count returns an Iterator yielding numbers starting at 0 and increasing by 1.
func CountFrom ¶ added in v0.7.0
func CountFrom[T constraints.Integer](start T) itkit.Iterator[T]
CountFrom returns an Iterator yielding numbers starting at the given value in start and increasing by 1.
func CountStep ¶ added in v0.7.0
func CountStep[T constraints.Integer](start, step T) itkit.Iterator[T]
CountStep returns an Iterator yielding numbers starting at the given value in start and increasing by the given value in step.
func Range ¶ added in v0.7.0
func Range[T constraints.Signed](stop T) itkit.Iterator[T]
Range returns an iterator yielding [0 .. stop)
Types ¶
type CountIterator ¶ added in v0.7.0
type CountIterator[T constraints.Integer] struct { // contains filtered or unexported fields }
CountIterator represents an iterator which yields numbers starting at a given value and increases by a given value every time Next is called.
func (*CountIterator[T]) Next ¶ added in v0.7.0
func (c *CountIterator[T]) Next() bool
func (*CountIterator[T]) Value ¶ added in v0.7.0
func (c *CountIterator[T]) Value() T
type RangeIterator ¶ added in v0.7.0
type RangeIterator[T constraints.Signed] struct { // contains filtered or unexported fields }
RangeIterator provides an [Iterator] over an immutable sequence of numbers.
func (*RangeIterator[T]) Next ¶ added in v0.7.0
func (r *RangeIterator[T]) Next() bool
Next advances the iterator to the first/next item, returning true if successful meaning there is an item available to be fetched with Value and false otherwise.
See [Iterator] for more details.
func (*RangeIterator[T]) Value ¶ added in v0.7.0
func (r *RangeIterator[T]) Value() T