Documentation
¶
Overview ¶
Package signal provides typed, pull-based broadcasts for systems. A Hub stores signals by type, and each Reader maintains an independent cursor. Tick signals are readable during their tick and carried into the following frame window; frame signals are discarded at Hub.EndFrame.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub stores signals by type and rotates them between frame and tick windows.
func (*Hub) Consumer ¶
Consumer returns a system that calls update for each unread signal of type T in the current window. Each returned system has an independent Reader, so consumers do not compete for signals.
Use Hub.NewReader when one system reads several signal types or needs to manage the reader's lifetime directly.
func (*Hub) EndFrame ¶
func (h *Hub) EndFrame()
EndFrame discards remaining frame signals and starts tick collection.
type Reader ¶
type Reader[T any] struct { // contains filtered or unexported fields }
Reader tracks an independent position while reading signals of type T. Sharing a Reader between consumers splits delivery between them.