pub fn expand_event_enum(input: &EventEnumDecl) -> syn::Result<TokenStream> {
    let ruma_events = crate::import_ruma_events();

    let name = &input.name;
    let attrs = &input.attrs;
    let events: Vec<_> = input.events.iter().map(|entry| entry.ev_type.clone()).collect();
    let variants: Vec<_> =
        input.events.iter().map(EventEnumEntry::to_variant).collect::<syn::Result<_>>()?;

    let event_enum = expand_any_with_deser(
        name,
        &events,
        attrs,
        &variants,
        &EventKindVariation::Full,
        &ruma_events,
    );

    let sync_event_enum = expand_any_with_deser(
        name,
        &events,
        attrs,
        &variants,
        &EventKindVariation::Sync,
        &ruma_events,
    );

    let stripped_event_enum = expand_any_with_deser(
        name,
        &events,
        attrs,
        &variants,
        &EventKindVariation::Stripped,
        &ruma_events,
    );

    let initial_event_enum = expand_any_with_deser(
        name,
        &events,
        attrs,
        &variants,
        &EventKindVariation::Initial,
        &ruma_events,
    );

    let redacted_event_enums = expand_any_redacted(name, &events, attrs, &variants, &ruma_events);

    let event_content_enum = expand_content_enum(name, &events, attrs, &variants, &ruma_events);

    Ok(quote! {
        #event_enum

        #sync_event_enum

        #stripped_event_enum

        #initial_event_enum

        #redacted_event_enums

        #event_content_enum
    })
}
/// Create a content enum from `EventEnumInput`.
Create a content enum from `EventEnumInput`.
Create a content enum from ` EventEnumInput ` .
pub fn expand_event_enum(input: &EventEnumDecl) -> syn::Result<TokenStream> {
    let ruma_events = crate::import_ruma_events();
    let name = &input.name;
    let attrs = &input.attrs;
    let events: Vec<_> = input.events.iter().map(|entry| entry.ev_type.clone()).collect();
    let variants: Vec<_> =
        input.events.iter().map(EventEnumEntry::to_variant).collect::<syn::Result<_>>()?;
    let event_enum = expand_any_with_deser(
        name,
        &events,
        attrs,
        &variants,
        &EventKindVariation::Full,
        &ruma_events,
    );
    let sync_event_enum = expand_any_with_deser(
        name,
        &events,
        attrs,
        &variants,
        &EventKindVariation::Sync,
        &ruma_events,
    );
    let stripped_event_enum = expand_any_with_deser(
        name,
        &events,
        attrs,
        &variants,
        &EventKindVariation::Stripped,
        &ruma_events,
    );
    let initial_event_enum = expand_any_with_deser(
        name,
        &events,
        attrs,
        &variants,
        &EventKindVariation::Initial,
        &ruma_events,
    );
    let redacted_event_enums = expand_any_redacted(name, &events, attrs, &variants, &ruma_events);
    let event_content_enum = expand_content_enum(name, &events, attrs, &variants, &ruma_events);
    Ok(quote! {
        #event_enum
        #sync_event_enum
        #stripped_event_enum
        #initial_event_enum
        #redacted_event_enums
        #event_content_enum
    })
}
pub fn expand_event_enum ( input : & EventEnumDecl ) -> syn :: Result < TokenStream > { let ruma_events = crate :: import_ruma_events ( ) ; let name = & input . name ; let attrs = & input . attrs ; let events : Vec < _ > = input . events . iter ( ) . map ( | entry | entry . ev_type . clone ( ) ) . collect ( ) ; let variants : Vec < _ > = input . events . iter ( ) . map ( EventEnumEntry :: to_variant ) . collect :: < syn :: Result < _ > > ( ) ? ; let event_enum = expand_any_with_deser ( name , & events , attrs , & variants , & EventKindVariation :: Full , & ruma_events , ) ; let sync_event_enum = expand_any_with_deser ( name , & events , attrs , & variants , & EventKindVariation :: Sync , & ruma_events , ) ; let stripped_event_enum = expand_any_with_deser ( name , & events , attrs , & variants , & EventKindVariation :: Stripped , & ruma_events , ) ; let initial_event_enum = expand_any_with_deser ( name , & events , attrs , & variants , & EventKindVariation :: Initial , & ruma_events , ) ; let redacted_event_enums = expand_any_redacted ( name , & events , attrs , & variants , & ruma_events ) ; let event_content_enum = expand_content_enum ( name , & events , attrs , & variants , & ruma_events ) ; Ok ( quote ! { event_enum sync_event_enum stripped_event_enum initial_event_enum redacted_event_enums event_content_enum } ) }
Create a content enum from `EventEnumInput`.
Create a content enum from ` EventEnumInput ` .
input
&EventEnumDecl