Documentation ¶
Overview ¶
Package comm provides primitives for communication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoolNotifier ¶
ColorNotifier wraps Notifier with an additional Value() method which returns a bool.
type BytesNotifier ¶
ColorNotifier wraps Notifier with an additional Value() method which returns a []byte.
type ColorNotifier ¶
ColorNotifier wraps Notifier with an additional Value() method which returns a color.Color.
type DurationNotifier ¶
ColorNotifier wraps Notifier with an additional Value() method which returns a time.Duration.
type Float64Notifier ¶
ColorNotifier wraps Notifier with an additional Value() method which returns a float64.
type Float64Value ¶
type Float64Value struct {
// contains filtered or unexported fields
}
Float64Value implements the Float64Notifier interface and a setter that updates the value and triggers notifications.
func NewFloat64Value ¶
func NewFloat64Value(val float64) *Float64Value
Convenience function that returns a new Float64Value set to val.
func (*Float64Value) Notify ¶
func (v *Float64Value) Notify(f func()) Id
Notify implements the Float64Notifier interface.
func (*Float64Value) SetValue ¶
func (v *Float64Value) SetValue(val float64)
SetValue updates v.Value() and notifies any observers.
func (*Float64Value) Unnotify ¶
func (v *Float64Value) Unnotify(id Id)
Unnotify implements the Float64Notifier interface.
func (*Float64Value) Value ¶
func (v *Float64Value) Value() float64
Value implements the Float64Notifier interface.
type Int64Notifier ¶
ColorNotifier wraps Notifier with an additional Value() method which returns an int64.
type IntNotifier ¶
ColorNotifier wraps Notifier with an additional Value() method which returns an int.
type InterfaceNotifier ¶
type InterfaceNotifier interface { Notifier Value() interface{} }
ColorNotifier wraps Notifier with an additional Value() method which returns an empty interface.
type Notifier ¶
Notifier is the interface the wraps the Notify and Unnotify methods.
Notify stores the function f, and calls in the future it when the object updates. It returns an Id which can be used to stop notifications. Every call to Notify should have a corresponding Unnotify or there could be leaks.
type Relay ¶
type Relay struct {
// contains filtered or unexported fields
}
Relay implements the Notifier interface, and provides methods for triggering notifications and republishing notifications from other notifiers. It can be embeded into other structs.
func (*Relay) Subscribe ¶
Subscribes to notifications from n. When n posts a notification, r will also post a notification. For every Subscribe there should be a corresponding Unsubscribe or memory leaks may occur.
type StringNotifier ¶
ColorNotifier wraps Notifier with an additional Value() method which returns a string.
type Uint64Notifier ¶
ColorNotifier wraps Notifier with an additional Value() method which returns a uint64.
type UintNotifier ¶
ColorNotifier wraps Notifier with an additional Value() method which returns an uint.