derive_variant_fields_expr

Function derive_variant_fields_expr 

Source
fn derive_variant_fields_expr(
    bindings: &[BindingInfo<'_>],
    where_clause: &mut Option<WhereClause>,
) -> TokenStream
Expand description

Generate the match arm expression for fields of a struct or enum variant in a derived ToTyped implementation.

This helper examines the variant’s fields and determines whether it can safely generate a .to_typed() call for a single inner value. If the variant has exactly one non-skipped, non-iterable field, it emits a call to that field’s ToTyped implementation and adds the corresponding trait bound (e.g. T: ToTyped) to the where clause.

Variants with multiple usable fields or iterable fields are not yet supported and simply return None.