MCPcopy Create free account
hub / github.com/Soft/iter / ToSlice

Function ToSlice

iterator.go:81–87  ·  view source on GitHub ↗

ToSlice consumes an Iterator creating a slice from the yielded values.

(it Iterator[T])

Source from the content-addressed store, hash-verified

79
80// ToSlice consumes an Iterator creating a slice from the yielded values.
81func ToSlice[T any](it Iterator[T]) []T {
82 result := []T{}
83 ForEach(it, func(v T) {
84 result = append(result, v)
85 })
86 return result
87}
88
89// ToString consumes a rune Iterator creating a string.
90func ToString(it Iterator[rune]) string {

Callers 8

TestToSliceFunction · 0.85
TestDropFunction · 0.85
TestDropWhileFunction · 0.85
TestTakeWhileFunction · 0.85
TestChainFunction · 0.85
TestFlattenFunction · 0.85
TestRangeFunction · 0.85
ToStringFunction · 0.85

Calls 1

ForEachFunction · 0.85

Tested by 7

TestToSliceFunction · 0.68
TestDropFunction · 0.68
TestDropWhileFunction · 0.68
TestTakeWhileFunction · 0.68
TestChainFunction · 0.68
TestFlattenFunction · 0.68
TestRangeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…