MCPcopy
hub / github.com/duke-git/lancet / FromSlice

Function FromSlice

iterator/iterator.go:92–94  ·  view source on GitHub ↗

Functions that create an Iterator from some other type. // FromSlice returns an iterator over a slice of data.

(slice []T)

Source from the content-addressed store, hash-verified

90
91// FromSlice returns an iterator over a slice of data.
92func FromSlice[T any](slice []T) *SliceIterator[T] {
93 return &SliceIterator[T]{slice: slice, index: -1}
94}
95
96func ToSlice[T any](iter Iterator[T]) []T {
97 result := []T{}

Callers 8

IteratorMethod · 0.92
TestSliceIteratorFunction · 0.70
TestChannelIteratorFunction · 0.70
TestMapIteratorFunction · 0.70
TestFilterIteratorFunction · 0.70
TestJoinIteratorFunction · 0.70
TestReduceFunction · 0.70
TestTakeIteratorFunction · 0.70

Calls

no outgoing calls

Tested by 7

TestSliceIteratorFunction · 0.56
TestChannelIteratorFunction · 0.56
TestMapIteratorFunction · 0.56
TestFilterIteratorFunction · 0.56
TestJoinIteratorFunction · 0.56
TestReduceFunction · 0.56
TestTakeIteratorFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…