| {{/* |
| // Copyright 2018 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| */}} |
| |
| {{- define "GenerateLibraryFile" -}} |
| // WARNING: This file is machine generated by fidlgen. |
| {{ range $experiment := .Experiments }} |
| // fidl_experiment = {{ $experiment }} |
| {{- end }} |
| |
| package {{ .Name }} |
| |
| {{if .Libraries}} |
| import ( |
| {{- range .Libraries }} |
| {{ .Alias }} "{{ .Path }}" |
| {{- end }} |
| ) |
| {{end}} |
| |
| {{if .Consts}} |
| const ( |
| {{- range $const := .Consts }} |
| {{- range .DocComments}} |
| //{{ . }} |
| {{- end}} |
| {{ .Name }} {{ .Type }} = {{ .Value }} |
| {{- end }} |
| ) |
| {{end}} |
| |
| {{ range .Aliases -}} |
| type {{ .Name }} = {{ .Type }} |
| {{ end -}} |
| {{ range .Enums -}} |
| var _ {{ $.BindingsAlias }}.Enum = {{ .Name }}(0) |
| {{ template "EnumDefinition" . }} |
| {{ end -}} |
| {{ range .Bits -}} |
| var _ {{ $.BindingsAlias }}.Bits = {{ .Name }}(0) |
| {{ template "BitsDefinition" . }} |
| {{ end -}} |
| {{ range .Structs -}} |
| {{ template "StructDefinition" . }} |
| {{ end -}} |
| {{ range .Unions -}} |
| {{ template "UnionDefinition" . }} |
| {{ end -}} |
| {{ range .Tables -}} |
| {{ template "TableDefinition" . }} |
| {{ end -}} |
| {{ range $protocol := .Protocols -}} |
| {{ range $transport, $_ := .Transports -}}{{ if eq $transport "Channel" -}} |
| {{ template "ProtocolDefinition" $protocol }} |
| {{ end }}{{ end }}{{ end -}} |
| |
| {{- end -}} |