ctxchan

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chan

type Chan[T any] chan Msg[T]

Chan represents read/write chan.

func Make

func Make[T any](size int) Chan[T]

func (Chan[T]) Receive

func (ch Chan[T]) Receive() (context.Context, T)

func (Chan[T]) Send

func (ch Chan[T]) Send(ctx context.Context, data T)

type Msg

type Msg[T any] struct {
	Ctx  context.Context
	Data T
}

type ReadOnly

type ReadOnly[T any] <-chan Msg[T]

ReadOnly represents read-only chan.

func FanIn

func FanIn[T any](channelBufferCap int, upstreams ...ReadOnly[T]) ReadOnly[T]

func FanOut

func FanOut[T any](count int, channelsBufferCap int, upstream ReadOnly[T]) []ReadOnly[T]

func MakeRead

func MakeRead[T any](size int) ReadOnly[T]

func (ReadOnly[T]) Loop

func (ch ReadOnly[T]) Loop(yield func(context.Context, T) bool)

func (ReadOnly[T]) Receive

func (ch ReadOnly[T]) Receive() (context.Context, T)

type WriteOnly

type WriteOnly[T any] chan<- Msg[T]

WriteOnly represents write-only chan.

func MakeWrite

func MakeWrite[T any](size int) WriteOnly[T]

func (WriteOnly[T]) Send

func (ch WriteOnly[T]) Send(ctx context.Context, data T)

Jump to

Keyboard shortcuts

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