If a payload is created from a value (as opposed to a byte slice) it does not have a CBOR representation. If Decode() is called, the value is first encoded, then immediately unencoded. Whilst this does ensure that the semantics of decode are always the same, it is completely unnecessary.
Instead, we should use reflection to assign to the decode target in much the same way as codec's decoder.Decode().
If a payload is created from a value (as opposed to a byte slice) it does not have a CBOR representation. If
Decode()
is called, the value is first encoded, then immediately unencoded. Whilst this does ensure that the semantics of decode are always the same, it is completely unnecessary.Instead, we should use reflection to assign to the decode target in much the same way as codec's
decoder.Decode()
.