tee

package
v0.0.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Push

func Push[V any](seq iter.Seq[V], f ...func(V) bool) bool

Experimental: not tested and might be changed any time.

func Push2

func Push2[K, V any](seq iter.Seq2[K, V], f ...func(K, V) bool) bool

Experimental: not tested and might be changed any time.

func TeeSeq

func TeeSeq[V any](seq iter.Seq[V], pusher func(v V) bool) iter.Seq[V]

TeeSeq is iter.Seq equivalent of io.TeeReader.

TeeSeq returns a iter.Seq that pushes to pusher what it reads from seq. Yielding values from the returned iterator performs push before the inner loop receives the value. The iterator is not stateful; you may want to wrap it with iterable.Resumable. If pusher returns false, the iterator stops iteration without yielding value.

Experimental: not tested and might be changed any time.

func TeeSeq2

func TeeSeq2[K, V any](seq iter.Seq2[K, V], pusher func(K, V) bool) iter.Seq2[K, V]

TeeSeq2 is iter.Seq2 equivalent of io.TeeReader.

TeeSeq2 returns a iter.Seq2 that pushes to pusher what it reads from seq. Yielding key-value pairs from the returned iterator performs push before the inner loop receives the pair. The iterator is not stateful; you may want to wrap it with iterable.Resumable2. If pusher returns false, the iterator stops iteration without yielding pair.

Experimental: not tested and might be changed any time.

Types

type Pipe

type Pipe[V any] struct {
	// contains filtered or unexported fields
}

Experimental: not tested and might be changed any time.

func NewPipe

func NewPipe[V any](n int) *Pipe[V]

Experimental: not tested and might be changed any time.

func TeeSeqPipe

func TeeSeqPipe[V any](bufSize int, seq iter.Seq[V]) (*Pipe[V], *iterable.Resumable[V])

TeeSeqPipe tees values from seq to *Pipe. see doc comments for TeeSeq. Yielding values from returned *iterable.Resumable also performs push to *Pipe.

Experimental: not tested and might be changed any time.

func (*Pipe[V]) Close

func (p *Pipe[V]) Close()

func (*Pipe[V]) IntoIter

func (p *Pipe[V]) IntoIter() iter.Seq[V]

func (*Pipe[V]) Push

func (p *Pipe[V]) Push(v V) bool

func (*Pipe[V]) TryPush

func (p *Pipe[V]) TryPush(v V) (open, pushed bool)

type Pipe2

type Pipe2[K, V any] struct {
	// contains filtered or unexported fields
}

Experimental: not tested and might be changed any time.

func NewPipe2

func NewPipe2[K, V any](n int) *Pipe2[K, V]

Experimental: not tested and might be changed any time.

func TeeSeqPipe2

func TeeSeqPipe2[K, V any](bufSize int, seq iter.Seq2[K, V]) (*Pipe2[K, V], *iterable.Resumable2[K, V])

TeeSeqPipe2 tees key-value pairs from seq to *Pipe2. see doc comments for TeeSeq2. Yielding pairs from returned *iterable.Resumable2 also performs push to *Pipe2.

Experimental: not tested and might be changed any time.

func (*Pipe2[K, V]) Close

func (p *Pipe2[K, V]) Close()

func (*Pipe2[K, V]) IntoIter2

func (p *Pipe2[K, V]) IntoIter2() iter.Seq2[K, V]

func (*Pipe2[K, V]) Push

func (p *Pipe2[K, V]) Push(k K, v V) bool

func (*Pipe2[K, V]) TryPush

func (p *Pipe2[K, V]) TryPush(k K, v V) (open, pushed bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL