blob: 0c7b3ef75fa1f17fed37671ed066e2c409d9ff21 [file] [log] [blame]
// 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.
package codegen
const enumTmpl = `
{{- define "EnumDeclaration" -}}
{{- range .DocComments}}
///{{ . }}
{{- end}}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr({{ .Type }})]
pub enum {{ .Name }} {
{{- range .Members }}
{{- range .DocComments }}
///{{ . }}
{{- end }}
{{ .Name }} = {{ .Value }},
{{- end }}
}
fidl_enum! {
name: {{ .Name }},
prim_ty: {{ .Type }},
members: [
{{- range .Members }}
{{ .Name }} { value: {{ .Value }}, },
{{- end }}
],
}
{{ end }}
`