Closed
Description
When one simply wants to create a set of custom types to be used as a field of type interface{}, you really just want to register a type number with a normal struct.
Currently, you must add 4 boiler plate functions to satisfy the Extension interface.
Is there a reason for making the extension interface not use the same function names as (Un)Marshaller and add the additional ExtensionType function?
Example code I have copy/pasted (and renamed struct) in my code:
func (i *Identity) ExtensionType() int8 {
return IdentityT
}
func (i *Identity) Len() int {
return i.Msgsize()
}
func (i *Identity) MarshalBinaryTo(b []byte) error {
_, err := i.MarshalMsg(b)
return err
}
func (i *Identity) UnmarshalBinary(b []byte) error {
_, err := i.UnmarshalMsg(b)
return err
}
Metadata
Metadata
Assignees
Labels
No labels