summaryrefslogtreecommitdiffstats
path: root/third_party/rust/uniffi_bindgen/src/scaffolding/templates/EnumTemplate.rs
blob: f918ef2f3a55088f9a5bf313964021a62cf14f48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{#
// Forward work to `uniffi_macros` This keeps macro-based and UDL-based generated code consistent.
#}

#[::uniffi::derive_enum_for_udl(
    {%- if e.is_non_exhaustive() -%}
    non_exhaustive,
    {%- endif %}
)]
enum r#{{ e.name() }} {
    {%- for variant in e.variants() %}
    r#{{ variant.name() }} {
        {%- for field in variant.fields() %}
        r#{{ field.name() }}: {{ field.as_type().borrow()|type_rs }},
        {%- endfor %}
    },
    {%- endfor %}
}