channel

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithBuffer

func WithBuffer[T any](i int) func(*Channel[T])

WithBuffer sets the buffer size of the channel.

Types

type Channel

type Channel[T any] struct {
	// contains filtered or unexported fields
}

Channel provides methods for safely reading from and writing to channels.

func New

func New[T any](options ...func(*Channel[T])) *Channel[T]

func (*Channel[T]) Close

func (c *Channel[T]) Close()

Closes the channel. If the channel is already closed, then this is a no-op.

func (*Channel[T]) Recv

func (c *Channel[T]) Recv() <-chan T

Recv returns a read-only channel.

func (*Channel[T]) Send

func (c *Channel[T]) Send(t T)

Sends a value to the channel. If the channel is closed, then this is a no-op.

Jump to

Keyboard shortcuts

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