feed

package
v0.11.6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tee

func Tee[T any](sub *Subscription[T], f *Feed[T])

Tee forwards all values received from sub to f. It stops tee-ing values when sub is unsubscribed.

Types

type Feed

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

func New

func New[T any]() *Feed[T]

func (*Feed[T]) Send

func (f *Feed[T]) Send(v T)

Send broadcasts v to all subscribers. Send will skip subscribers that block. Subscribers risk reading stale data if they wait a long time before calling Recv.

func (*Feed[T]) Subscribe

func (f *Feed[T]) Subscribe() *Subscription[T]

type Subscription

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

func (*Subscription[T]) Recv

func (s *Subscription[T]) Recv() <-chan T

func (*Subscription[T]) Unsubscribe

func (s *Subscription[T]) Unsubscribe()

Jump to

Keyboard shortcuts

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