If a struct like the following is passed to the Unmarshaler, then it is unclear as to how the unmarshaler would know which concrete type to fill into the struct field:
type ConvolutedIndirectable interface {
ConvolutedIndirection() int
}
type Indirector struct {
I int
}
func (i *Indirector) ConvolutedIndirection() int {
return i.I
}
type One struct {
A ConvolutedIndirectable
}
func main() {
reader := ...
var o One
if err := reader.Unmarshal(&o); err != nil {
...
}
}
When the struct is marshaled the information about what struct was actually in the interface is lost, only an un-type-annotated map is transferred via CBOR, so it does not seem possible to work out what type to create to put in this field when unmarshaling.
If a struct like the following is passed to the Unmarshaler, then it is unclear as to how the unmarshaler would know which concrete type to fill into the struct field:
When the struct is marshaled the information about what struct was actually in the interface is lost, only an un-type-annotated map is transferred via CBOR, so it does not seem possible to work out what type to create to put in this field when unmarshaling.