send

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package send provides functions for non-blocking sending of values to channels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drop

func Drop[T any](ch chan<- T, val T) bool

Drop attempts to send val to ch. If ch is full, val is discarded instead of blocking. Returns true if val was successfully sent.

func DropCtx

func DropCtx[T any](ctx context.Context, ch chan<- T, val T) bool

DropCtx attempts to send val to ch with context. If ctx is canceled, val is discarded, otherwise blocks until either ctx is canceled or val is sent. Returns true if val was successfully sent.

func Replace

func Replace[T any](ch chan T, val T) bool

Replace forces val into ch. If ch is full, discards the oldest values to make space. Returns true if no values were discarded during the operation.

func ReplaceCb

func ReplaceCb[T any](ch chan T, val T, cb func(old T)) bool

ReplaceCb forces val into ch, calling cb for each discarded value. If ch is full, discards the oldest values to make space. Returns true if no values were discarded during the operation.

func WaitCtx

func WaitCtx[T any](ctx context.Context, ch chan<- T, val T) bool

WaitCtx attempts to send val to ch with context. If ch is full, blocks until either ctx is canceled or val is sent. Returns true if val was successfully sent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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