Debian Codegraph @

third_party/rust/uniffi_bindgen/src/scaffolding/templates/ErrorTemplate.rs

raw
1 {#
2 // Forward work to `uniffi_macros` This keeps macro-based and UDL-based generated code consistent.
3 #}
4
5 {%- if e.remote() %}
6 #[::uniffi::udl_remote(Error)]
7 {%- else %}
8 #[::uniffi::udl_derive(Error)]
9 {%- endif %}
10 {% if e.is_flat() -%}
11 #[uniffi(flat_error)]
12 {% if ci.should_generate_error_read(e) -%}
13 #[uniffi(with_try_read)]
14 {%- endif %}
15 {%- endif %}
16 {%- if e.is_non_exhaustive() -%}
17 #[non_exhaustive]
18 {%- endif %}
19 enum r#{{ e.name() }} {
20 {%- for variant in e.variants() %}
21 r#{{ variant.name() }} {
22 {%- for field in variant.fields() %}
23 r#{{ field.name() }}: {{ field.as_type().borrow()|type_rs }},
24 {%- endfor %}
25 },
26 {%- endfor %}
27 }