mirror of
https://github.com/charmbracelet/crush.git
synced 2025-08-02 05:20:46 +03:00
chore: rename seq2
This commit is contained in:
@@ -149,8 +149,8 @@ func (s *Slice[T]) Seq() iter.Seq[T] {
|
||||
}
|
||||
}
|
||||
|
||||
// SeqWithIndex returns an iterator that yields index-value pairs from the slice.
|
||||
func (s *Slice[T]) SeqWithIndex() iter.Seq2[int, T] {
|
||||
// Seq2 returns an iterator that yields index-value pairs from the slice.
|
||||
func (s *Slice[T]) Seq2() iter.Seq2[int, T] {
|
||||
// Take a snapshot to avoid holding the lock during iteration
|
||||
items := s.Slice()
|
||||
return func(yield func(int, T) bool) {
|
||||
|
||||
@@ -250,7 +250,7 @@ func TestSlice(t *testing.T) {
|
||||
|
||||
var indices []int
|
||||
var values []string
|
||||
for i, v := range s.SeqWithIndex() {
|
||||
for i, v := range s.Seq2() {
|
||||
indices = append(indices, i)
|
||||
values = append(values, v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user