source

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConstSource

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

ConstSource always returns the same value.

func NewConstSource

func NewConstSource[T any](clk clock.Clock, value T) *ConstSource[T]

NewConstSource creates a source that always returns the given value.

func (*ConstSource[T]) Subscribe

func (s *ConstSource[T]) Subscribe() <-chan T

Subscribe returns a channel that receives constant values on each clock tick.

type Publisher

type Publisher[T any] interface {
	Subscribe() <-chan T
}

Publisher provides a subscription interface for typed values.

type RandomIntSource

type RandomIntSource struct {
	// contains filtered or unexported fields
}

RandomIntSource generates random integers within a range [min, max].

func NewRandomIntSource

func NewRandomIntSource(clk clock.Clock, min, max int) *RandomIntSource

NewRandomIntSource creates a source that generates random integers in the inclusive range [min, max].

func (*RandomIntSource) Subscribe

func (s *RandomIntSource) Subscribe() <-chan int

Subscribe returns a channel that receives random integers on each clock tick.

Jump to

Keyboard shortcuts

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