File: iterator.go

package info (click to toggle)
golang-github-zclconf-go-cty 1.12.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,464 kB
  • sloc: makefile: 2
file content (15 lines) | stat: -rw-r--r-- 207 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package set

type Iterator[T any] struct {
	vals []T
	idx  int
}

func (it *Iterator[T]) Value() T {
	return it.vals[it.idx]
}

func (it *Iterator[T]) Next() bool {
	it.idx++
	return it.idx < len(it.vals)
}