Documentation ¶
Index ¶
Constants ¶
View Source
const MaxValueLength = math.MaxInt32
MaxValueLength denotes the maximum length of the value in bytes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallbackFunc ¶
CallbackFunc specifies the type of callbacks.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) Handle ¶
Handle reads the next TLV-encoded message from r and calls the corresponding callback with its value. It returns an error when the message is encoded incorrectly.
func (*Registry) Register ¶
func (r *Registry) Register(t TypeCode, m encoding.BinaryMarshaler, callback CallbackFunc)
Register registers a new type for the TLV-encoder. The type of m will be stored to allow type code selection with Write. The callback is called when a new value of that type is received. Register can be used to re-define the callback of a type, but it panics when a different t is registered for the same type.
Click to show internal directories.
Click to hide internal directories.