Debian Codegraph @

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

raw
1 # This file was autogenerated by some hot garbage in the `uniffi` crate.
2 # Trust me, you don't want to mess with it!
3
4 # Common helper code.
5 #
6 # Ideally this would live in a separate .rb file where it can be unittested etc
7 # in isolation, and perhaps even published as a re-useable package.
8 #
9 # However, it's important that the details of how this helper code works (e.g. the
10 # way that different builtin types are passed across the FFI) exactly match what's
11 # expected by the rust code on the other side of the interface. In practice right
12 # now that means coming from the exact some version of `uniffi` that was used to
13 # compile the rust component. The easiest way to ensure this is to bundle the Ruby
14 # helpers directly inline like we're doing here.
15
16 require 'ffi'
17
18
19 module {{ ci.namespace()|class_name_rb }}
20 {% include "Helpers.rb" %}
21
22 {% include "RustBufferTemplate.rb" %}
23 {% include "RustBufferStream.rb" %}
24 {% include "RustBufferBuilder.rb" %}
25
26 # Error definitions
27 {% include "ErrorTemplate.rb" %}
28
29 {% include "NamespaceLibraryTemplate.rb" %}
30
31 # Public interface members begin here.
32
33 {% for e in ci.enum_definitions() %}
34 {% if !ci.is_name_used_as_error(e.name()) %}
35 {% include "EnumTemplate.rb" %}
36 {% endif %}
37 {%- endfor -%}
38
39 {%- for rec in ci.record_definitions() %}
40 {% include "RecordTemplate.rb" %}
41 {% endfor %}
42
43 {% for func in ci.function_definitions() %}
44 {% include "TopLevelFunctionTemplate.rb" %}
45 {% endfor %}
46
47 {% for obj in ci.object_definitions() %}
48 {% include "ObjectTemplate.rb" %}
49 {% endfor %}
50 end
51
52 {% import "macros.rb" as rb %}