summaryrefslogtreecommitdiffstats
path: root/third_party/rust/uniffi_bindgen/src/scaffolding/templates/scaffolding_template.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/uniffi_bindgen/src/scaffolding/templates/scaffolding_template.rs')
-rw-r--r--third_party/rust/uniffi_bindgen/src/scaffolding/templates/scaffolding_template.rs52
1 files changed, 52 insertions, 0 deletions
diff --git a/third_party/rust/uniffi_bindgen/src/scaffolding/templates/scaffolding_template.rs b/third_party/rust/uniffi_bindgen/src/scaffolding/templates/scaffolding_template.rs
new file mode 100644
index 0000000000..c88e204e97
--- /dev/null
+++ b/third_party/rust/uniffi_bindgen/src/scaffolding/templates/scaffolding_template.rs
@@ -0,0 +1,52 @@
+// This file was autogenerated by some hot garbage in the `uniffi` crate.
+// Trust me, you don't want to mess with it!
+{% import "macros.rs" as rs %}
+
+::uniffi::setup_scaffolding!("{{ ci.namespace() }}");
+
+{% include "UdlMetadata.rs" %}
+
+{% for ty in ci.iter_types() %}
+{%- match ty %}
+{%- when Type::Map { key_type: k, value_type: v } -%}
+{# Next comment MUST be after the line to be in the compiler output #}
+uniffi::deps::static_assertions::assert_impl_all!({{ k|type_rs }}: ::std::cmp::Eq, ::std::hash::Hash); // record<{{ k|type_rs }}, {{ v|type_rs }}>
+{%- else %}
+{%- endmatch %}
+{% endfor %}
+
+{% for e in ci.enum_definitions() %}
+{% if ci.is_name_used_as_error(e.name()) %}
+// Error definitions, corresponding to `error` in the UDL.
+{% include "ErrorTemplate.rs" %}
+{% else %}
+// Enum definitions, corresponding to `enum` in UDL.
+{% include "EnumTemplate.rs" %}
+{% endif %}
+{% endfor %}
+
+// Record definitions, implemented as method-less structs, corresponding to `dictionary` objects.
+{% for rec in ci.record_definitions() %}
+{% include "RecordTemplate.rs" %}
+{% endfor %}
+
+// Top level functions, corresponding to UDL `namespace` functions.
+{%- for func in ci.function_definitions() %}
+{% include "TopLevelFunctionTemplate.rs" %}
+{% endfor -%}
+
+// Object definitions, corresponding to UDL `interface` definitions.
+{% for obj in ci.object_definitions() %}
+{% include "ObjectTemplate.rs" %}
+{% endfor %}
+
+// Callback Interface definitions, corresponding to UDL `callback interface` definitions.
+{% for cbi in ci.callback_interface_definitions() %}
+{% include "CallbackInterfaceTemplate.rs" %}
+{% endfor %}
+
+// External and Wrapped types
+{% include "ExternalTypesTemplate.rs" %}
+
+// Export scaffolding checksums for UDL items
+{% include "Checksums.rs" %}