code: func generateUnionMethods(w io.Writer, structName string) {
  	// generate struc.Custom implementation for union
  	fmt.Fprintf(w, `
  func (u *%[1]s) Pack(p []byte, opt *struc.Options) (int, error) {
  	var b = new(bytes.Buffer)
  	if err := struc.PackWithOptions(b, u.union_data, opt); err != nil {
  		return 0, err
  	}
  	copy(p, b.Bytes())
  	return b.Len(), nil
  }
  func (u *%[1]s) Unpack(r io.Reader, length int, opt *struc.Options) error {
  	return struc.UnpackWithOptions(r, u.union_data[:], opt)
  }
  func (u *%[1]s) Size(opt *struc.Options) int {
  	return len(u.union_data)
  }
  func (u *%[1]s) String() string {
  	return string(u.union_data[:])
  }
  `, structName)
  }
docs: // generateUnionMethods generates methods that implement struc.Custom
  // interface to allow having Union_data field unexported
  // TODO: do more testing when unions are actually used in some messages