Backed out 5 changesets (bug 1890092, bug 1888683) for causing build bustages & crash...
[gecko.git] / third_party / rust / uniffi_bindgen / src / scaffolding / templates / RecordTemplate.rs
blob85e131dd8cf7c70ec4fafb1b081e0bd3d81636bb
1 {#
2 // For each record declared in the UDL, we assume the caller has provided a corresponding
3 // rust `struct` with the declared fields. We provide the traits for sending it across the FFI.
4 // If the caller's struct does not match the shape and types declared in the UDL then the rust
5 // compiler will complain with a type error.
6 //
7 // We define a unit-struct to implement the trait to sidestep Rust's orphan rule (ADR-0006). It's
8 // public so other crates can refer to it via an `[External='crate'] typedef`
9 #}
11 #[::uniffi::derive_record_for_udl]
12 struct r#{{ rec.name() }} {
13     {%- for field in rec.fields() %}
14     r#{{ field.name() }}: {{ field.as_type().borrow()|type_rs }},
15     {%- endfor %}