| {{/* |
| // 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" -}} |
| {{- $root := . }} |
| |
| // WARNING: This file is machine generated by fidlgen. |
| {{ range $experiment := $root.Experiments }} |
| // fidl_experiment = {{ $experiment }} |
| {{- end }} |
| |
| package {{ $root.Name }} |
| |
| {{ if $root.Libraries }} |
| import ( |
| {{- range $lib := $root.Libraries }} |
| {{ $lib.Alias }} "{{ $lib.Path }}" |
| {{- end }} |
| ) |
| {{ end }} |
| |
| {{ if $root.Consts }} |
| const ( |
| {{- range $const := $root.Consts }} |
| {{- range $comment := $const.DocComments }} |
| //{{ $comment }} |
| {{- end }} |
| {{ $const.Name }} {{ $const.Type }} = {{ $const.Value }} |
| {{- end }} |
| ) |
| {{ end }} |
| |
| {{ range $alias := $root.Aliases -}} |
| type {{ $alias.Name }} = {{ $alias.Type }} |
| {{ end -}} |
| {{ range $enum := $root.Enums -}} |
| var _ {{ $root.BindingsAlias }}.Enum = {{ $enum.Name }}(0) |
| {{ template "EnumDefinition" $enum }} |
| {{ end -}} |
| {{ range $bits := $root.Bits -}} |
| var _ {{ $root.BindingsAlias }}.Bits = {{ $bits.Name }}(0) |
| {{ template "BitsDefinition" $bits }} |
| {{ end -}} |
| {{ range $struct := $root.Structs -}} |
| {{ template "StructDefinition" $struct }} |
| {{ end -}} |
| {{ range $union := $root.Unions -}} |
| {{ template "UnionDefinition" $union }} |
| {{ end -}} |
| {{ range $table := $root.Tables -}} |
| {{ template "TableDefinition" $table }} |
| {{ end -}} |
| {{ range $protocol := $root.Protocols -}} |
| {{ range $transport, $_ := $protocol.Transports -}}{{ if eq $transport "Channel" -}} |
| {{ template "ProtocolDefinition" $protocol }} |
| {{ end }}{{ end }}{{ end -}} |
| |
| {{- end -}} |