package ld import ( "fmt" "reflect" "sectorinf.com/emilis/flabk/pkg/ld/internal/parse" "sectorinf.com/emilis/flabk/pkg/ld/internal/parse/chunk" ) func Unmarshal[T any](v []byte) (T, error) { ptr := new(T) if err := parse.SetValue(reflect.ValueOf(ptr), reflect.TypeOf(ptr), chunk.New(v)); err != nil { return *ptr, fmt.Errorf("unmarshal: %w", err) } return *ptr, nil }