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

Function TakeWhile

iterator.go:170–176  ·  view source on GitHub ↗

TakeWhile returns an Iterator adapter that yields values from the underlying Iterator as long as pred predicate function returns true.

(it Iterator[T], pred func(T) bool)

Source from the content-addressed store, hash-verified

168// TakeWhile returns an Iterator adapter that yields values from the underlying
169// Iterator as long as pred predicate function returns true.
170func TakeWhile[T any](it Iterator[T], pred func(T) bool) Iterator[T] {
171 return &takeWhileIter[T]{
172 inner: it,
173 pred: pred,
174 done: false,
175 }
176}
177
178func (it *takeWhileIter[T]) Next() Option[T] {
179 if it.done {

Callers 1

TestTakeWhileFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestTakeWhileFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…