summaryrefslogtreecommitdiffstats
path: root/third_party/rust/uniffi_bindgen/src/bindings/ruby/templates/TopLevelFunctionTemplate.rb
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/uniffi_bindgen/src/bindings/ruby/templates/TopLevelFunctionTemplate.rb')
-rw-r--r--third_party/rust/uniffi_bindgen/src/bindings/ruby/templates/TopLevelFunctionTemplate.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/third_party/rust/uniffi_bindgen/src/bindings/ruby/templates/TopLevelFunctionTemplate.rb b/third_party/rust/uniffi_bindgen/src/bindings/ruby/templates/TopLevelFunctionTemplate.rb
new file mode 100644
index 0000000000..13214cf31b
--- /dev/null
+++ b/third_party/rust/uniffi_bindgen/src/bindings/ruby/templates/TopLevelFunctionTemplate.rb
@@ -0,0 +1,16 @@
+{%- match func.return_type() -%}
+{%- when Some with (return_type) %}
+
+def self.{{ func.name()|fn_name_rb }}({%- call rb::arg_list_decl(func) -%})
+ {%- call rb::coerce_args(func) %}
+ result = {% call rb::to_ffi_call(func) %}
+ return {{ "result"|lift_rb(return_type) }}
+end
+
+{% when None %}
+
+def self.{{ func.name()|fn_name_rb }}({%- call rb::arg_list_decl(func) -%})
+ {%- call rb::coerce_args(func) %}
+ {% call rb::to_ffi_call(func) %}
+end
+{% endmatch %}