iter

package module
v0.0.0-...-4b1f184 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 4 Imported by: 0

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]

func Clip2

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

Clip2 will stop 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]

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 Values

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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