// The interface *mostly* isn't used... except for in the return type of a speciated function which can be used to do golang-native type switches.
//
// The interface also includes a requirement for an errorless primitive access method (such as `String() string`)
// if our representation strategy is one that has that semantic (e.g., stringprefix repr does).
//
// A note about index: in all cases the index of a member type is used, we increment it by one, to avoid using zero.
// We do this because it's desirable to reserve the zero in the 'tag' field (if we generate one) as a sentinel value
// (see further comments in the EmitNodeAssemblerType function);
// and since we do it in that one case, it's just as well to do it uniformly.
doTemplate(`
{{- if Comments -}}
// {{ .Type | TypeSymbol }} matches the IPLD Schema type "{{ .Type.Name }}". It has {{ .Type.TypeKind }} type-kind, and may be interrogated like {{ .Kind }} kind.
// {{ .Type | TypeSymbol }} matches the IPLD Schema type "{{ .Type.Name }}".
// {{ .Type | TypeSymbol }} has {{ .Type.TypeKind }} typekind, which means its data model behaviors are that of a {{ .Kind }} kind.
ss := mixins.SplitN(v, "{{ .Type.RepresentationStrategy.GetDelim }}", 2)
if len(ss) != 2 {
return ipld.ErrUnmatchable{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr"}.Reasonf("expecting a stringprefix union but found no delimiter in the value")
}
switch ss[0] {
{{- range $i, $member := .Type.Members }}
case "{{ $member | dot.Type.RepresentationStrategy.GetDiscriminant }}":
{{- if (eq (dot.AdjCfg.UnionMemlayout dot.Type) "embedAll") }}