Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToInterface ¶
func ConvertToInterface[T msgType](msgs []*T, convertFunc func(m *T))
this is because Go doesn't support covariance on slices []*T -> []I does not work
Types ¶
type Collector ¶
type Collector[T msgType] struct {
// contains filtered or unexported fields
}
Collector is a single message type collector
func NewCollector ¶
func NewCollector[T msgType]() *Collector[T]
NewCollector creates a new message collector
func (*Collector[T]) AddMessage ¶
AddMessage adds a new message to the collector
func (*Collector[T]) DropMessages ¶
DropMessages drops all messages from the collection if their view is less than the given view (earlier)
func (*Collector[T]) GetMessages ¶
func (c *Collector[T]) GetMessages() []*T
GetMessages returns the currently present messages in the collector
type MsgCallback ¶
type MsgCallback[T msgType] func() []*T
MsgCallback is the callback that returns all given messages
Click to show internal directories.
Click to hide internal directories.