beam

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultEqual added in v0.12.1

func DefaultEqual[T comparable](old T, new T) bool

func NeverEqual added in v0.12.1

func NeverEqual[T any](T, T) bool

Types

type Beam

type Beam[T1, T2 any] = *beam[T1, T2]

func NewBeam

func NewBeam[T1 any, T2 any](source Beamer[T1], get func(T1) T2, equal func(old T2, new T2) bool) Beam[T1, T2]

type Beamer added in v0.12.1

type Beamer[T any] interface {
	Get() T
	Equal(a T, b T) bool
	Watch(ctx context.Context, w Watcher[T]) (context.CancelFunc, bool)
	// contains filtered or unexported methods
}

type Cinema

type Cinema = *cinema

func NewCinema

func NewCinema(parent Cinema, door Door) Cinema

func (Cinema) ReadFrame added in v0.8.14

func (c Cinema) ReadFrame() shredder.ReleaseFrame

type Cloner added in v0.13.17

type Cloner[T any] interface {
	Clone() T
}

type Core

type Core interface {
	Cinema() Cinema
}

type Door

type Door interface {
	Runtime() shredder.Runtime
	ReadFrame() shredder.ReleaseFrame
	Context() context.Context
}

type Lens added in v0.12.1

type Lens[T1, T2 any] = *lens[T1, T2]

func NewLens added in v0.12.1

func NewLens[T1 any, T2 any](source Lenser[T1], get func(T1) T2, set func(T1, T2) T1, equal func(old T2, new T2) bool) Lens[T1, T2]

type Lenser added in v0.12.1

type Lenser[T any] interface {
	Beamer[T]
	Update(context.Context, T) <-chan error
	Mutate(context.Context, func(T) T) <-chan error
}

type Source

type Source[T any] = *source[T]

func NewSource

func NewSource[T any](init T, equal func(old T, new T) bool, noSkip bool) Source[T]

type Watcher

type Watcher[T any] interface {
	// Cancel runs when the subscription ends, whether the context was canceled
	// or the returned cancel function was called.
	Cancel()
	// Watch receives the current value on the calling goroutine, then every
	// update. Return true to end the subscription.
	Watch(ctx context.Context, value T) bool
}

Watcher is a subscriber to a value stream.

Jump to

Keyboard shortcuts

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