Debian Codegraph @

third_party/rust/uniffi_bindgen/src/bindings/ruby/templates/NamespaceLibraryTemplate.rb

raw
1 # This is how we find and load the dynamic library provided by the component.
2 # For now we just look it up by name.
3 module UniFFILib
4 extend FFI::Library
5
6 {% if config.custom_cdylib_path() %}
7 ffi_lib {{ config.cdylib_path() }}
8 {% else %}
9 ffi_lib '{{ config.cdylib_name() }}'
10 {% endif %}
11
12 {% for func in ci.iter_ffi_function_definitions_non_async() -%}
13 attach_function :{{ func.name() }},
14 {%- call rb::arg_list_ffi_decl(func) %},
15 {% match func.return_type() %}{% when Some with (type_) %}{{ type_|type_ffi }}{% when None %}:void{% endmatch %}
16 {% endfor %}
17 end