pub fn gen_pyo3_data_enum(enum_def: &EnumDef, core_import: &str) -> StringExpand description
Generate a PyO3 data enum as a #[pyclass] struct wrapping the core type.
Data enums (tagged unions like AuthConfig) can’t be flat int enums in PyO3.
Instead, generate a frozen struct with inner that accepts a Python dict,
serializes it to JSON, and deserializes into the core Rust type via serde.
When any variant field is sanitized (its type could not be resolved — e.g. contains
dyn Stream + Send which is not Serialize/Deserialize/Default), the serde-
based constructor and trait impls are omitted. The constructor body uses todo!()
so the generated code still compiles while making it clear the conversion is not
available at runtime.