iter

package module
v0.0.0-...-9ab52ad Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 4 Imported by: 4

README

iter

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cast2

func Cast2[K constraints.Ordered, V1, V2 any](iter1 iter.Seq2[K, V1]) iter.Seq2[K, V2]

Cast2 converts the iterator K,V1 to an iterator of K,V2. It uses interface type casting to do so, which means either V1 or V2 should be an interface that is type castable to the other type. It will panic if not.

func Clip

func Clip[K any](i1 iter.Seq[K], n int) iter.Seq[K]

Clip stops the iteration after n times.

func Clip2

func Clip2[K, V any](it iter.Seq2[K, V], n int) iter.Seq2[K, V]

Clip2 stops the iteration after n times.

func KeySort

func KeySort[Map ~map[K]V, K constraints.Ordered, V any](m Map) iter.Seq2[K, V]

KeySort returns an iterator that iterates the given map by ordered keys so that iteration is repeatable and predictable.

func Keys

func Keys[K constraints.Ordered, V any](i1 iter.Seq2[K, V]) iter.Seq[K]

Keys converts a Seq2 to a Seq, iterating on just the first item in the sequence.

func MatchKeys

func MatchKeys[K comparable, V any, S ~[]K](it iter.Seq2[K, V], keys S) iter.Seq2[K, V]

MatchKeys will pass only the pairs that have the first item in keys.

func MatchValues

func MatchValues[K comparable, V comparable, S ~[]V](it iter.Seq2[K, V], values S) iter.Seq2[K, V]

MatchValues will pass only the pairs that have the second item in values.

func Values

func Values[K constraints.Ordered, V any](i1 iter.Seq2[K, V]) iter.Seq[V]

Values converts a Seq2 to a Seq, iterating on just the second item in the sequence.

Types

This section is empty.

Jump to

Keyboard shortcuts

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