blob: 247c135e0081e910186a00914ddb99891268e911 [file] [log] [blame]
{{/*
// Copyright 2022 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 "Method:Types:WireMessagingHeader" }}
{{ IfdefFuchsia }}
{{ EnsureNamespace "" }}
template<>
struct {{ .WireMethodTypes }} {
{{- if and .HasResponse (not .HasRequest) }}
{{/* Events */}}
static constexpr bool HasRequestPayload = {{ .HasResponsePayload }};
{{- if .HasResponsePayload }}
using Request = {{ .ResponsePayload }};
{{- end }}
{{- else }}
static constexpr bool HasRequestPayload = {{ .HasRequestPayload }};
{{- if .HasRequestPayload }}
using Request = {{ .RequestPayload }};
{{- end }}
{{- if .HasResponsePayload }}
using Response = {{ .ResponsePayload }};
{{- end }}
{{- end }}
{{- if .HasDomainError }}
using DomainError = {{ .Result.ErrorDecl }};
{{- end }}
{{- if or (not .HasResponse) .HasRequest }}
{{/* One way or two way client calls */}}
{{- if .HasResponse }}
using Completer = fidl::Completer<{{ .WireCompleterBase }}>;
{{- else }}
using Completer = fidl::Completer<>;
{{- end }}
{{- end }}
{{- if and .HasRequest .HasResponse }}
using Thenable = ::fidl::internal::WireThenableImpl<
{{ .Marker }},
::fidl::internal::OwnedEncodedMessage<
{{ .WireTransactionalRequest }}, {{ .Transport.Type }}
>
>;
using BufferThenable = ::fidl::internal::WireThenableImpl<
{{ .Marker }},
::fidl::internal::UnownedEncodedMessage<
{{ .WireTransactionalRequest }}, {{ .Transport.Type }}
>
>;
{{- end }}
};
{{ EndifFuchsia }}
{{- end }}
{{- define "Method:Types:NaturalMessagingHeader" }}
{{ EnsureNamespace "" }}
template<>
struct {{ .NaturalMethodTypes }} {
{{ if and .HasResponse (not .HasRequest) }}
{{/* Events */}}
{{ if .HasResponsePayload }}
using Request = {{ .ResponsePayload }};
{{ end }}
{{ else }}
{{ if .HasRequestPayload }}
using Request = {{ .RequestPayload }};
{{ end }}
{{ if .HasResponsePayload }}
using Response = {{ .ResponsePayload }};
{{ end }}
{{ end }}
{{- if or (not .HasResponse) .HasRequest }}
{{/* One way or two way client calls */}}
{{- if .HasResponse }}
using Completer = fidl::Completer<{{ .NaturalCompleterBase }}>;
{{- else }}
using Completer = fidl::Completer<>;
{{- end }}
{{- end }}
{{- if and .HasRequest .HasResponse }}
using ResultCallback =
::fit::callback<void ({{ .NaturalResult }}&)>;
{{- end }}
};
{{- end }}