chans

package
v0.0.0-...-14c7dbf Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Offer

func Offer[C xconstraints.Send[V], V any](ctx context.Context, c C, v V) error

Offer attempts to send a value on the channel, respecting context cancellation. It returns the context error if the context is cancelled before the send completes.

func OfferSeq

func OfferSeq[Int constraints.Integer, C xconstraints.Send[V], V any](ctx context.Context, c C, seq iter.Seq[V]) (Int, error)

OfferSeq sends all values from the iterator sequence to the channel, respecting context cancellation. It returns the number of values sent and the context error if the context is cancelled.

func OfferSeqNoError

func OfferSeqNoError[Int constraints.Integer, C xconstraints.Send[V], V any](ctx context.Context, c C, seq iter.Seq[V]) Int

OfferSeqNoError sends all values from the iterator sequence to the channel, respecting context cancellation. It returns the number of values sent, discarding any context error.

func Poll

func Poll[C xconstraints.Receive[V], V any](ctx context.Context, c C) (V, error)

Poll attempts to receive a value from the channel, respecting context cancellation. It returns the context error if the context is cancelled before a value is received.

func PollSeq

func PollSeq[C xconstraints.Receive[V], V any](ctx context.Context, c C) iter.Seq2[V, error]

PollSeq returns an iterator that receives values from the channel, respecting context cancellation. It yields pairs of (value, error), where error is non-nil when the context is cancelled.

func PollSeqNoError

func PollSeqNoError[C xconstraints.Receive[V], V any](ctx context.Context, c C) iter.Seq[V]

PollSeqNoError returns an iterator that receives values from the channel, respecting context cancellation. It stops when the context is cancelled, discarding the error.

func RecvSeq

func RecvSeq[C xconstraints.Receive[V], V any](c C) iter.Seq[V]

RecvSeq returns an iterator that yields all values received from the channel until it is closed.

func SendSeq

func SendSeq[Int constraints.Integer, C xconstraints.Send[V], V any](c C, seq iter.Seq[V]) Int

SendSeq sends all values from the iterator sequence to the channel. It returns the number of values sent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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