iterable

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chan

type Chan[V any] struct {
	Ctx context.Context
	C   <-chan V
}

Chan adds IntoIter method to a receive only channel.

func (Chan[V]) IntoIter

func (c Chan[V]) IntoIter() iter.Seq[V]

type Heap

type Heap[T any] struct {
	heap.Interface
}

Heap adds IntoIter method to a heap.Interface.

func (Heap[T]) IntoIter

func (h Heap[T]) IntoIter() iter.Seq[T]

type IndexAccessible added in v0.0.6

type IndexAccessible[A hiter.Atter[T], T any] struct {
	hiter.Atter[T]
	Indices hiter.Iterable[int]
}

func (IndexAccessible[A, T]) Iter2 added in v0.0.6

func (a IndexAccessible[A, T]) Iter2() iter.Seq2[int, T]

type JsonDecoder added in v0.0.6

type JsonDecoder struct {
	*json.Decoder
}

JsonDecoder adds IntoIter2 to *json.Decoder.

func (JsonDecoder) IntoIter2 added in v0.0.6

func (dec JsonDecoder) IntoIter2() iter.Seq2[json.Token, error]

type ListAll added in v0.0.5

type ListAll[T any] struct {
	*list.List
}

ListAll adds Iter method to *list.ListAll.

func (ListAll[T]) Iter added in v0.0.5

func (l ListAll[T]) Iter() iter.Seq[T]

type ListBackward

type ListBackward[T any] struct {
	*list.List
}

ListBackward adds Iter method to *list.List. Iter returns an iterator that traverses list backward.

func (ListBackward[T]) Iter

func (l ListBackward[T]) Iter() iter.Seq[T]

type ListElementAll added in v0.0.5

type ListElementAll[T any] struct {
	*list.Element
}

ListElementAll adds Iter method to *list.Element.

func (ListElementAll[T]) Iter added in v0.0.5

func (l ListElementAll[T]) Iter() iter.Seq[T]

type ListElementBackward added in v0.0.4

type ListElementBackward[T any] struct {
	*list.Element
}

ListElementBackward adds Iter method to *list.Element. Iter returns an iterator that traverses list backward.

func (ListElementBackward[T]) Iter added in v0.0.4

func (l ListElementBackward[T]) Iter() iter.Seq[T]

type MapAll

type MapAll[K comparable, V any] map[K]V

MapAll adds Iter2 method to map[K]V that merely calling maps.All.

func (MapAll[K, V]) Iter2

func (m MapAll[K, V]) Iter2() iter.Seq2[K, V]

type MapSorted

type MapSorted[K cmp.Ordered, V any] map[K]V

MapSorted adds Iter2 to map[K]V where K is basic ordered type. Iter2 takes snapshot of keys and sort it in ascending order, then returns an iterator over pairs of the keys and values that correspond to each key.

func (MapSorted[K, V]) Iter2

func (m MapSorted[K, V]) Iter2() iter.Seq2[K, V]

type MapSortedFunc

type MapSortedFunc[M ~map[K]V, K comparable, V any] struct {
	M   M
	Cmp func(K, K) int
}

MapSortedFunc adds Iter2 to map[K]V. Iter2 takes snapshot of keys and sort it using the comparison function, then returns an iterator over pairs of the keys and values that correspond to each key.

func (MapSortedFunc[M, K, V]) Iter2

func (m MapSortedFunc[M, K, V]) Iter2() iter.Seq2[K, V]

type Range

type Range[T hiter.Numeric] struct {
	Start, End T
}

Range adds Iter method to the pair of 2 Numeric values.

func (Range[T]) Iter

func (r Range[T]) Iter() iter.Seq[T]

Iter returns an iterator that yields sequential Numeric values in the interval [Start, End). Values start from `start` and steps toward `end`. At each step value is increased by 1 if start < end, otherwise decreased by 1.

type Repeatable

type Repeatable[V any] struct {
	V V
	N int
}

Repeatable generates an iterator that generates V N times.

func (Repeatable[V]) Iter

func (r Repeatable[V]) Iter() iter.Seq[V]

type Repeatable2

type Repeatable2[K, V any] struct {
	K K
	V V
	N int
}

Repeatable2 generates an iterator that generates pairs of K and V N times.

func (Repeatable2[K, V]) Iter2

func (r Repeatable2[K, V]) Iter2() iter.Seq2[K, V]

type RepeatableFunc added in v0.0.3

type RepeatableFunc[V any] struct {
	FnV func() V
	N   int
}

RepeatableFunc generates an iterator that generates value returned from FnV N times.

func (RepeatableFunc[V]) Iter added in v0.0.3

func (r RepeatableFunc[V]) Iter() iter.Seq[V]

type RepeatableFunc2 added in v0.0.3

type RepeatableFunc2[K, V any] struct {
	FnK func() K
	FnV func() V
	N   int
}

RepeatableFunc2 generates an iterator that generates pairs of value that FnK and FnV return N times.

func (RepeatableFunc2[K, V]) Iter2 added in v0.0.3

func (r RepeatableFunc2[K, V]) Iter2() iter.Seq2[K, V]

type RingAll added in v0.0.9

type RingAll[T any] struct {
	*ring.Ring
}

RingAll adds Iter method to *ring.RingAll.

func (RingAll[T]) Iter added in v0.0.9

func (r RingAll[T]) Iter() iter.Seq[T]

type RingBackward

type RingBackward[T any] struct {
	*ring.Ring
}

RingBackward adds Iter method to *ring.Ring. Iter returns an iterator that traverses ring backward.

func (RingBackward[T]) Iter

func (r RingBackward[T]) Iter() iter.Seq[T]

type Scanner

type Scanner struct {
	*bufio.Scanner
}

func (Scanner) IntoIter added in v0.0.9

func (s Scanner) IntoIter() iter.Seq[string]

type SliceAll

type SliceAll[E any] []E

SliceAll adds Iter and Iter2 methods to slice of any element E. They merely call slices.Values, slices.All respectively.

func (SliceAll[E]) Iter

func (s SliceAll[E]) Iter() iter.Seq[E]

func (SliceAll[E]) Iter2

func (s SliceAll[E]) Iter2() iter.Seq2[int, E]

type SliceBackward

type SliceBackward[E any] []E

SliceBackward adds Iter and Iter2 methods to slice of any element E. They return iterators over []E traversing them backward with descending indices.

func (SliceBackward[E]) Iter

func (s SliceBackward[E]) Iter() iter.Seq[E]

func (SliceBackward[E]) Iter2

func (s SliceBackward[E]) Iter2() iter.Seq2[int, E]

type SqlRows added in v0.0.9

type SqlRows[T any] struct {
	Rows    *sql.Rows
	Scanner func(*sql.Rows) (T, error)
}

SqlRows adds IntoIter2 to *sql.Rows. For detailed behavior, see hiter.SqlRows.

func (SqlRows[T]) IntoIter2 added in v0.0.9

func (s SqlRows[T]) IntoIter2() iter.Seq2[T, error]

type SyncMap

type SyncMap[K comparable, V any] struct {
	*sync.Map
}

SyncMap adds Iter2 method that merely calls sync.Map.Range.

func (SyncMap[K, V]) Iter2

func (s SyncMap[K, V]) Iter2() iter.Seq2[K, V]

type XmlDecoder added in v0.0.6

type XmlDecoder struct {
	*xml.Decoder
}

XmlDecoder adds IntoIter2 to *xml.Decoder.

func (XmlDecoder) IntoIter2 added in v0.0.6

func (dec XmlDecoder) IntoIter2() iter.Seq2[xml.Token, error]

Jump to

Keyboard shortcuts

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