github.com/anacrolix/torrent@v1.61.0/internal/indexed/pair.go (about) 1 package indexed 2 3 import ( 4 "iter" 5 ) 6 7 func MapPairIterRight[K, V any](i iter.Seq[Pair[K, V]]) iter.Seq[V] { 8 return func(yield func(V) bool) { 9 for p := range i { 10 if !yield(p.Right) { 11 return 12 } 13 } 14 } 15 } 16 17 func MapPairIterLeft[K, V any](i iter.Seq[Pair[K, V]]) iter.Seq[K] { 18 return func(yield func(K) bool) { 19 for p := range i { 20 if !yield(p.Left) { 21 return 22 } 23 } 24 } 25 }