chanreader

package
v0.0.0-...-c443d34 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithBufferSize

func WithBufferSize(bufsize int) func(*ChanReader)

func WithCloseFunc

func WithCloseFunc(closeFunc func()) func(*ChanReader)

func WithErrorFunc

func WithErrorFunc(errorFunc func(error)) func(*ChanReader)

Types

type ChanReader

type ChanReader struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, r io.Reader, mods ...func(*ChanReader)) *ChanReader

New returns a ChanReader, which will read from r until EOF or error, sending each read to a channel. If the provided context is cancelled, reads will terminate and the reader will be closed if it is an io.Closer. These behaviors can be overridden by various modifiers.

func (*ChanReader) ReadChan

func (cr *ChanReader) ReadChan() <-chan []byte

type Publisher

type Publisher struct {
	// contains filtered or unexported fields
}

func NewPublisher

func NewPublisher(ctx context.Context, reader io.ReadCloser, mods ...func(chanReader *ChanReader)) *Publisher

func (*Publisher) SubscribePackets

func (p *Publisher) SubscribePackets() <-chan []byte

func (*Publisher) UnsubscribePackets

func (p *Publisher) UnsubscribePackets(pktCh <-chan []byte)

Jump to

Keyboard shortcuts

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