parser

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: CC-BY-4.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeregisterMessageParserCallback

func DeregisterMessageParserCallback[T any](r *MessageParsers_Registry, handler *TypedHandler[*T])

Generic function to register parser and callback for type T

if `parser` is nil, the callback will be called upon any non-error unmarshall of messages (not recommended unless it is the only message structure that is received)

Types

type CallbackFunc

type CallbackFunc[T any] func(T)

type MessageParsers_Registry

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

MessageParsers_Registry to store generic handlers

func (*MessageParsers_Registry) TryDispatch

func (parserRegistry *MessageParsers_Registry) TryDispatch(msg []byte) (callback_called bool)

type ParserFunc

type ParserFunc[T any] func([]byte) (bool, T)

Parser and Callback types

type TypedHandler

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

Concrete handler for type T

func RegisterMessageParserCallback

func RegisterMessageParserCallback[T any](r *MessageParsers_Registry, parser ParserFunc[*T], callback CallbackFunc[*T]) *TypedHandler[*T]

Generic function to register parser and callback for type T

if `parser` is nil, the callback will be called upon any non-error unmarshall of messages (not recommended unless it is the only message structure that is received)

Jump to

Keyboard shortcuts

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