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

Function Take

iterator.go:144–149  ·  view source on GitHub ↗

Take returns an Iterator adapter that yields the n first elements from the underlying Iterator.

(it Iterator[T], n uint)

Source from the content-addressed store, hash-verified

142// Take returns an Iterator adapter that yields the n first elements from the
143// underlying Iterator.
144func Take[T any](it Iterator[T], n uint) Iterator[T] {
145 return &takeIter[T]{
146 inner: it,
147 take: n,
148 }
149}
150
151func (it *takeIter[T]) Next() Option[T] {
152 if it.take == 0 {

Callers 3

TestTakeFunction · 0.85
TestToSliceFunction · 0.85
TestForEachFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestTakeFunction · 0.68
TestToSliceFunction · 0.68
TestForEachFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…