oneshot

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Oneshot

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

Oneshot is oneshot cached channel

func NewOneshot

func NewOneshot[T any]() *Oneshot[T]

NewOneshot makes new Oneshot

func (*Oneshot[T]) Channel

func (o *Oneshot[T]) Channel() <-chan T

Channel returns a channel to get value. The value is always returned when already Send() called no matter Done() called. Channel returns a closed channel after Done() called without no Send() call.

func (*Oneshot[T]) Done

func (o *Oneshot[T]) Done()

Done finishes a channel from Channel()

func (*Oneshot[T]) Send

func (o *Oneshot[T]) Send(value T)

Send sends value without blocking. Send panics when called multiple times.

Jump to

Keyboard shortcuts

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