Debian Codegraph @

third_party/rust/uniffi_bindgen/src/scaffolding/templates/EnumTemplate.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(Enum)]
7 {%- else %}
8 #[::uniffi::udl_derive(Enum)]
9 {%- endif %}
10 {%- if e.is_non_exhaustive() %}
11 #[non_exhaustive]
12 {%- endif %}
13 enum r#{{ e.name() }} {
14 {%- for variant in e.variants() %}
15 r#{{ variant.name() }} {
16 {%- for field in variant.fields() %}
17 r#{{ field.name() }}: {{ field.as_type().borrow()|type_rs }},
18 {%- endfor %}
19 },
20 {%- endfor %}
21 }