blob: dc77299b80963246f0d97b53a287b56495226045 [file] [log] [blame] [edit]
{{/*
// 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 "TableDeclaration" }}
{{- range .DocComments }}
///{{ . }}
{{- end }}
{{ .Derives }}
pub struct {{ .Name }} {
{{- range .Members }}
{{- range .DocComments }}
///{{ . }}
{{- end }}
pub {{ .Name }}: Option<{{ .Type.Owned }}>,
{{- end }}
#[deprecated = "Use `..Default::default()` to construct and `..` to match."]
#[doc(hidden)]
pub __non_exhaustive: (),
}
{{- if .IsResourceType }}
impl fidl::Standalone for {{ .Name }} {}
{{- else }}
impl fidl::Persistable for {{ .Name }} {}
{{- end }}
fidl_table! {
name: {{ .Name }},
{{- if .IsResourceType }}
resource: true,
{{- end }}
members: [
{{- range .Members }}
{{ .Name }} {
ty: {{ .Type.Fidl }},
{{- if .Type.IsResourceType }}
resource: true,
{{- end }}
ordinal: {{ .Ordinal }},
},
{{- end }}
],
}
{{- end }}