beam

package
v0.12.7 Latest Latest
Warning

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

Go to latest
Published: May 11, 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](new T, old 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(new T2, old T2) bool) Beam[T1, T2]

type Beamer added in v0.12.1

type Beamer[T any] interface {
	Get() T
	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) IsEmpty

func (c Cinema) IsEmpty() bool

func (Cinema) ReadFrame added in v0.8.14

func (c Cinema) ReadFrame() shredder.Frame

type Core

type Core interface {
	Cinema() Cinema
}

type Door

type Door interface {
	Runtime() shredder.Runtime
	ReadFrame() shredder.Frame
	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(new T2, old T2) bool) Lens[T1, T2]

type Lenser added in v0.12.1

type Lenser[T any] interface {
	Beamer[T]
	Update(context.Context, T)
	XUpdate(context.Context, T) <-chan error
	Mutate(context.Context, func(T) T)
	XMutate(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(new T, old T) bool, noSkip bool) Source[T]

type Watcher

type Watcher[T any] interface {
	// Cancel is called when the watcher stops because of context cancellation or
	// an explicit cancel call.
	Cancel()
	// Watch receives the initial value synchronously and later updates
	// asynchronously. Returning true stops the watcher.
	Watch(ctx context.Context, value T) bool
}

Watcher receives low-level lifecycle callbacks for a Beamer.

Jump to

Keyboard shortcuts

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