Documentation ¶
Index ¶
- func All[T any](it Iterator[T], pred func(T) bool) bool
- func Any[T any](it Iterator[T], pred func(T) bool) bool
- func Count[T any](it Iterator[T]) uint
- func Equal[T comparable](first Iterator[T], second Iterator[T]) bool
- func EqualBy[T any](first Iterator[T], second Iterator[T], cmp func(T, T) bool) bool
- func Fold[T any, B any](it Iterator[T], init B, fn func(B, T) B) B
- func ForEach[T any](it Iterator[T], fn func(T))
- func ToSlice[T any](it Iterator[T]) []T
- func ToString(it Iterator[rune]) string
- type Iterator
- func Chain[T any](first Iterator[T], second Iterator[T]) Iterator[T]
- func Drop[T any](it Iterator[T], n uint) Iterator[T]
- func DropWhile[T any](it Iterator[T], pred func(T) bool) Iterator[T]
- func Empty[T any]() Iterator[T]
- func Filter[T any](it Iterator[T], pred func(T) bool) Iterator[T]
- func Flatten[T any](it Iterator[Iterator[T]]) Iterator[T]
- func Func[T any](fn func() Option[T]) Iterator[T]
- func Fuse[T any](it Iterator[T]) Iterator[T]
- func Map[T, R any](it Iterator[T], fn func(T) R) Iterator[R]
- func Once[T any](value T) Iterator[T]
- func Range(start, stop, step int) Iterator[int]
- func Repeat[T any](value T) Iterator[T]
- func Slice[T any](slice []T) Iterator[T]
- func String(input string) Iterator[rune]
- func Take[T any](it Iterator[T], n uint) Iterator[T]
- func TakeWhile[T any](it Iterator[T], pred func(T) bool) Iterator[T]
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
All tests if every element of the Iterator matches a predicate. An empty Iterator returns true.
func Any ¶
Any tests if any element of the Iterator matches a predicate. An empty Iterator returns false.
func Equal ¶
func Equal[T comparable](first Iterator[T], second Iterator[T]) bool
Determines if the elements of two Iterators are equal.
func EqualBy ¶
Determines if the elements of two Iterators are equal using function cmp to compare elements.
Types ¶
type Iterator ¶
Iterator[T] represents an iterator yielding elements of type T.
func Drop ¶
Drop returns an Iterator adapter that drops the first n elements from the underlying Iterator before yielding any values.
func DropWhile ¶
DropWhile returns an Iterator adapter that drops elements from the underlying Iterator until pred predicate function returns true.
func Filter ¶
Filter returns an Iterator adapter that yields elements from the underlying Iterator for which pred returns true.
func Fuse ¶
Fuse returns an Iterator adapter that will keep yielding None after the underlying Iterator has yielded None once.
func Map ¶
Map is an Iterator adapter that transforms each value yielded by the underlying iterator using fn.
type Option ¶
type Option[T any] struct { // contains filtered or unexported fields }
Options[T] represents an optional value of type T.
func (Option[T]) Unwrap ¶
func (opt Option[T]) Unwrap() T
Unwrap extracts a value from Option. Panics if Option does not contain a value.
func (Option[T]) UnwrapOr ¶
func (opt Option[T]) UnwrapOr(def T) T
UnwrapOr extracts a value from Option or returns a default value def if the Option is empty.
func (Option[T]) UnwrapOrElse ¶
func (opt Option[T]) UnwrapOrElse(fn func() T) T
UnwrapOrElse extracts a value from Option or computes a value by calling fn if the Option is empty.