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 (*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()
Click to show internal directories.
Click to hide internal directories.