Debian Codegraph @

third_party/rust/uniffi_bindgen/src/scaffolding/templates/macros.rs

raw
1 {#
2 // Template to receive calls into rust.
3
4 // Arglist as used in the _UniFFILib function declarations.
5 // Note unfiltered name but type_ffi filters.
6 -#}
7 {%- macro arg_list_ffi_decl(func) %}
8 {%- for arg in func.arguments() %}
9 r#{{- arg.name() }}: {{ arg.type_().borrow()|type_ffi -}},
10 {%- endfor %}
11 call_status: &mut uniffi::RustCallStatus
12 {%- endmacro -%}
13
14 {%- macro arg_list_decl_with_prefix(prefix, meth) %}
15 {{- prefix -}}
16 {%- if meth.arguments().len() > 0 %}, {# whitespace #}
17 {%- for arg in meth.arguments() %}
18 r#{{- arg.name() }}: {{ arg.as_type().borrow()|type_rs -}}{% if loop.last %}{% else %},{% endif %}
19 {%- endfor %}
20 {%- endif %}
21 {%- endmacro -%}
22
23 {% macro return_signature(func) %}
24 {%- match func.return_type() %}
25 {%- when Some with (return_type) %} -> {{ return_type|ffi_trait("LowerReturn") }}::ReturnType
26 {%- else -%}
27 {%- endmatch -%}
28 {%- endmacro -%}