on main help sign in
chore: rename seq2
ee45939Kujtim Hoxha
internal/csync/slices.go+2−2
@@ -149,8 +149,8 @@ func (s *Slice[T]) Seq() iter.Seq[T] {
149 }
149 }
150}
150}
151
151
152−// SeqWithIndex returns an iterator that yields index-value pairs from the slice.
152+// Seq2 returns an iterator that yields index-value pairs from the slice.
153−func (s *Slice[T]) SeqWithIndex() iter.Seq2[int, T] {
153+func (s *Slice[T]) Seq2() iter.Seq2[int, T] {
154 // Take a snapshot to avoid holding the lock during iteration
154 // Take a snapshot to avoid holding the lock during iteration
155 items := s.Slice()
155 items := s.Slice()
156 return func(yield func(int, T) bool) {
156 return func(yield func(int, T) bool) {
internal/csync/slices_test.go+1−1
@@ -250,7 +250,7 @@ func TestSlice(t *testing.T) {
250
250
251 var indices []int
251 var indices []int
252 var values []string
252 var values []string
253− for i, v := range s.SeqWithIndex() {
253+ for i, v := range s.Seq2() {
254 indices = append(indices, i)
254 indices = append(indices, i)
255 values = append(values, v)
255 values = append(values, v)
256 }
256 }