iterable

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToChannel

func ToChannel[A any](ctx context.Context, i Iterator[A]) <-chan A

func ToSlice

func ToSlice[A any](i Iterator[A]) []A

Types

type FunctionIterator

type FunctionIterator[A any] struct {
	F func() *A
}

func (*FunctionIterator[A]) Next

func (f *FunctionIterator[A]) Next() *A

type Iterable

type Iterable[A any] interface {
	Iterator() Iterator[A]
}

type Iterator

type Iterator[A any] interface {
	Next() *A // TODO should this be (A, bool) ?
}

func Filter added in v0.2.3

func Filter[A any](predicate func(A) bool, iterator Iterator[A]) Iterator[A]

func Map added in v0.2.3

func Map[A, B any](f func(A) B, iterator Iterator[A]) Iterator[B]

Jump to

Keyboard shortcuts

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