Documentation
¶
Overview ¶
Package iterutil provides utilities for iterators.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Seq2ToSeq ¶
Seq2ToSeq converts a iter.Seq2 to a iter.Seq.
Example ¶
ss := []string{"zero", "one", "two"}
it := Seq2ToSeq(slices.All(ss), NewKeyVal)
for kv := range it {
fmt.Println(kv.Key, kv.Val)
}
Output: 0 zero 1 one 2 two
func SeqToSeq2 ¶
func SeqToSeq2[In, Out1, Out2 any](in iter.Seq[In], convert func(In) (Out1, Out2)) iter.Seq2[Out1, Out2]
SeqToSeq2 converts a iter.Seq to a iter.Seq2.
Example ¶
kvs := []KeyVal[int, string]{
NewKeyVal(0, "zero"),
NewKeyVal(1, "one"),
NewKeyVal(2, "two"),
}
it := SeqToSeq2(slices.Values(kvs), KeyVal[int, string].Values)
for k, v := range it {
fmt.Println(k, v)
}
Output: 0 zero 1 one 2 two
Types ¶
Click to show internal directories.
Click to hide internal directories.