blob: 1c03ae887e8d49ecc9937dcac5ae8b02cbf78023 [file] [log] [blame]
// Copyright 2019 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 resultTmpl = `
{{- define "ResultDeclaration" }}
pub type {{ .Name }} = std::result::Result< (
{{- if gt (len .Ok) 1 }}
{{- range $ok := .Ok }}
{{ $ok.Type }},
{{- end }}
{{- else }}
{{- range $ok := .Ok }}
{{ $ok.Type }}
{{- end }}
{{- end }}
), {{ .ErrType }} >;
pub type {{ .Name }}HandleWrapper = std::result::Result< (
{{- range $ok := .Ok }}
{{ if $ok.HasHandleMetadata }}
{{ $ok.HandleWrapperName }}<{{ $ok.Type }}>,
{{ else }}
{{ $ok.Type }},
{{ end }}
{{- end }}
), {{ .ErrType }} >;
{{- end }}
`